OnError

Top  Previous  Next

×V4.0Ø

S

A

W

WS

ü

ü

Syntax - GoTo

OnError  GoTo <LabelName>

 

Description:

This command sets EMUE up to continue execution at the label specified by <LabelName> if an error is encountered during script execution.  This behavior is only in affect from the time the OnError command is run until another OnError command is run.

 

 

Syntax - Resume

OnError  Resume Next

 

Description:

This command will cause EMUE, upon encountering an error, to continue execution on the line following the line that erred.  This command does not clear the error condition.

 

 

Syntax - ExitError

OnError  ExitError

 

Description:

This command will cancel an error handling setup that was previously in place and will cause EMUE to resume handling errors by failing the script and sending an error email just as an ExitError command would.

 

Syntax - Block

OnError

...

EndOnError

 

Description:

This command will set up error handling so that when an error is encountered, the code between the OnError and the EndOnError will run.  In order to clear the error condition, a Resume or ClearError must still be used.  Using a GoTo within the error handling block is legal, but it will not clear the error condition even if the GoTo takes script execution out of the error handling block.

 

Note: Once an error has been encountered, information about the specific error is stored in the built-in variables &ErrorMessage, &ErrorCategory, &ErrorNumber, &ErrorID, and &ErrorLineNumber.  &ErrorMessage contains a text description of the error.  &ErrorCategory indicates which command had an error and &ErrorNumber corresponds to the specific error for that command. &ErrorID returns the ID of the last error trapped by EMUE's error handling. &ErrorLineNumber returns the Line Number of the error for the last error trapped by EMUE's error handling. These variables can be used to decide what should happen once an error has been detected and script execution has begun after.

 

See Also:

Resume

ClearError