Go Back

Further Broadening - wscript error handling

   Windows scripting is a powerful tool that I had really not explored (until i had to on Friday).

What I did pick up though was that error handling is not as robust as .net and pretty much useless error messages when you do use it. So I put something together for it to help me find problems. I'm paraphrasing because i am lazy.

 

Function Assert(area)

   If Err.Number > 0 Then

      wscript.echo(Err.Description & " in area: "& area & " [Error number: " & Err.Number & " ]"

     wscript.quit(0)

Function End

 

then in my code i might have something like this:

set iisObj = GetObject("IIS:/localhost/w3svc/1/root")

Assert("Getting IIS")

Facebook DZone It! Digg It! StumbleUpon Technorati Del.icio.us NewsVine Reddit Blinklist Furl it!

Post a comment!
  1. Formatting options