Forum Moderators: open

Message Too Old, No Replies

vbs error handling

major help needed

         

T_Virus

12:31 pm on May 11, 2006 (gmt 0)

10+ Year Member



Hi All,

I have an ASP script that creates universal sign-on accounts. This script is quite intensive and long. It grabs data from various sources, makes changes to the central source and creates logs.

I have now covert the ASP file to a vbs file so that it runs as a scheduled task.

I now need to amend the code so that, if an error occurs, an email is sent out with all the details of the error.

Please help.

duckhunter

11:40 pm on May 12, 2006 (gmt 0)

10+ Year Member



Use the On Error Resume Next feature and Trap the Error by checking the err.number property.

Sub TrySomething
On Error Resume Next
--- some code executing

If err.number <> 0 Then
sendmail(err.description)
Exit Sub
End If

--- some other code executing

If err.number <> 0 Then
sendmail(err.description)
Exit Sub
End If

End Sub

T_Virus

1:45 pm on May 15, 2006 (gmt 0)

10+ Year Member



Excellent. Thanks.