ClearError

Top  Previous  Next

×V4.0Ø

S

A

W

WS

ü

ü

Syntax -

ClearError

 

Description:

When handling an error in EMUE, information regarding what the error is and where the error occurred is stored in built-in variables.  This information (&ErrorMessage, &ErrorCategory, &ErrorNumber, &ErrorID, &ErrorLineNumber) is useful for deciding how to handle the error as well as what code should be run next.  Once the error has been sufficiently handled, this information should be cleared using the ClearError command so that it does not interfere with further processing.

 

Sample:

OnError GoTo ErrorHandlingProcedure

 

'Script code

 

:ErrorHandlingProcedure

If &ErrorCategory eq "MoveFile" Then

       'Wait 30 seconds then try again

       Sleep 30

       Resume

ElseIf &ErrorCategory eq "GetOLEDBData" Then

       'Try again immediately

       Resume

ElseIf &ErrorCategory eq "LogLine" Then

       'Since the line is only logging, skip it and move on

       Resume Next

ElseIf &ErrorCategory eq "OpenWebBrowser" Then

       'Continue execution at a different point of code, but first clear the error.

       ClearError

       GoTo Retry

Else

       'The error cannot be handled so the script is aborted

       LogLine "Script failed with the following error:  " ErrorMessage

       GoTo Abort

EndIf

 

See Also:

OnError

Resume