Difference between revisions of "ON ERROR"
From Lianjapedia
Yvonne.milne (Talk | contribs) |
Yvonne.milne (Talk | contribs) |
||
Line 18: | Line 18: | ||
procedure badfile | procedure badfile | ||
on error | on error | ||
− | + | messagebox("File does not exist.") | |
return to master | return to master | ||
Revision as of 07:34, 8 January 2013
Purpose
Trap program errors
Syntax
ON ERROR [<command>]
See Also
ASTACKTRACE(), DEBUGOUT, DISPLAY CALLS, DOSERROR(), ERRNO(), ERROR(), LIST CALLS, MESSAGE(), PROCLINE(), PROCNAME(), RETRY, SET DEBUGOUT, SET ONERROR, STRERROR()
Description
The ON ERROR command causes the specified <command> to be executed if an error is encountered in a program. If ON ERROR is specified without a <command>, then the default Lianja behavior will be restored.
<command>
The <command> can be any Lianja command. After an error is encountered, the ERROR() function will return the error number, and the MESSAGE() function will return the error message. Specifying an '*' as the command causes any errors to be ignored, so should be used with caution.
Example
procedure badfile on error messagebox("File does not exist.") return to master on error do badfile use patrons