Previous in Contents Next in Contents

Error Handling

You can use a subroutine like the following to display errors:

sub Error (Number, Message)
    Wscript.echo "Error #" & Number & " (0x" & Hex(Number) & ") received " & Message
end sub
 

Then you can call this subroutine whenever an SDK routine returns a non-zero value, as in the following example:

set SearchAdmin = CreateObject("Search.SearchAdmin.1")

if Err.Number <> 0 then
    Error Err.Number, "creating SearchAdmin object"
   Wscript.quit
end if
 

© 1997-2000 Microsoft Corporation. All rights reserved.