Difference between revisions of "ON ERROR"

From Lianjapedia
Jump to: navigation, search
m (1 revision)
 
(11 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
==Purpose==
 
==Purpose==
 
Trap program errors
 
Trap program errors
 
  
 
==Syntax==
 
==Syntax==
 
ON ERROR [<command>]
 
ON ERROR [<command>]
 
  
 
==See Also==
 
==See Also==
[[DOSERROR()]], [[DISPLAY CALLS]], [[ERRNO()]], [[ERROR()]], [[LIST CALLS]], [[MESSAGE()]], [[ON ESCAPE]], [[ON KEY]], [[PROCLINE()]], [[PROCNAME()]], [[RETRY]], [[SET ONERROR]], [[STRERROR()]]
+
[[ASTACKTRACE()]], [[BEGIN SEQUENCE]], [[DEBUGOUT]], [[DISPLAY CALLS]], [[DOSERROR()]], [[ERRNO()]], [[ERROR()]], [[LIST CALLS]], [[MESSAGE()]], [[PROCLINE()]], [[PROCNAME()]], [[RETRY]], [[SET DEBUGOUT]], [[SET EVENTTRACKING]], [[SET ONERROR]], [[STRERROR()]]
 
+
  
 
==Description==
 
==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 Recital behavior will be restored. By default, Recital will stop execution at the error and an error.mem file will be created
+
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>====
 
====<command>====
The <command> can be any Recital 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. The RETRY command is often used with the ON ERROR trapping facility.
+
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==
 
==Example==
Line 22: Line 18:
 
procedure badfile
 
procedure badfile
 
   on error
 
   on error
   set message to "File does not exist."
+
   messagebox("File does not exist.")
 
return to master
 
return to master
  
Line 29: Line 25:
 
</code>
 
</code>
  
 
==Products==
 
Recital Server, Recital
 
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Commands]]
 
[[Category:Commands]]
[[Category:Error Handling and Debugging]]
+
[[Category:Error Handling]]
[[Category:Error Handling and Debugging Commands]]
+

Latest revision as of 09:23, 11 October 2016

Purpose

Trap program errors

Syntax

ON ERROR [<command>]

See Also

ASTACKTRACE(), BEGIN SEQUENCE, DEBUGOUT, DISPLAY CALLS, DOSERROR(), ERRNO(), ERROR(), LIST CALLS, MESSAGE(), PROCLINE(), PROCNAME(), RETRY, SET DEBUGOUT, SET EVENTTRACKING, 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