| || |
Error handling issue
Hello, I need your help over errors handling issue.
I use TC 5, Visual Basic.
The issue is: during the execution script run time error (critical errors) may occur and execution will be stopped. The method On Error Resume Next - can't be really used because if critical error will occur - it would not be posted to the log.
Could you help me with this?
Re: Error handling issue
I'm guessing you want to try something similar to a Try/Catch block in other languages..
Here's how you can do that in VBScript..
Err.Clear ' make sure you start with a clear state.
'some code you know might cause an error.
If Err.Number <> 0 then
'error handling code.
Log.Error "Your error message"
Err.Clear ' clear out your error
On Error GoTo 0 'this will set things back so it'll halt on errors again.