This command allows Script errors to be captured, and Script execution to be resumed at a predefined label. The On_Error handler is local to all sections of the Script; it is NOT propagated to called Scripts.
All Script errors, such as a trying to opening a non-existing file, or an attempt to call a nonexistent Script, may be intercepted and dealt with by this command.
If a Script error is encountered, then a message is written in the audit log, identifying and locating where the error occurred.
An On_Error handler may be overridden by another On_Error command.
When On_Error checking is established, it can be disabled by using the Cancel_On_Error Command.
On_Error Goto labelName
A label defined within the current scope of the Script.
On_Error Goto MyLabel;
log "Open file";
// Try to open a non-existing file
Open "filename.txt" As fileid For Input;
log "File was opened successfully";
log "Error opening file";
Error opening file
Copyright © AgileLoad. All rights reserved.