Difference between revisions of "ON ERROR"

From Recital Documentation Wiki
Jump to: navigation, search
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
=ON ERROR=
 
 
 
==Class==
 
Error Handling and Debugging
 
 
 
 
==Purpose==
 
==Purpose==
 
Trap program errors
 
Trap program errors
Line 15: Line 8:
  
 
==See Also==
 
==See Also==
[[ERRNO()]], [[ERROR()]], [[MESSAGE()]], [[ON ESCAPE]], [[ON KEY]], [[RETRY]], [[SET ONERROR]]
+
[[DOSERROR()]], [[DISPLAY CALLS]], [[ERRNO()]], [[ERROR()]], [[LIST CALLS]], [[MESSAGE()]], [[ON ESCAPE]], [[ON KEY]], [[PROCLINE()]], [[PROCNAME()]], [[RETRY]], [[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/4GL behavior will be restored.  By default, the Recital/4GL 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 Recital behavior will be restored.  By default, Recital will stop execution at the error and an error.mem file will be created
  
 
====<command>====
 
====<command>====
The <command> can be any Recital/4GL 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 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.
  
  
Line 38: Line 31:
  
 
==Products==
 
==Products==
Recital Database Server, Recital Mirage Server, Recital Terminal Developer
+
Recital Server, Recital  
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Commands]]
 
[[Category:Commands]]
 
[[Category:Error Handling and Debugging]]
 
[[Category:Error Handling and Debugging]]
 
[[Category:Error Handling and Debugging Commands]]
 
[[Category:Error Handling and Debugging Commands]]

Latest revision as of 10:54, 15 December 2009

Purpose

Trap program errors


Syntax

ON ERROR [<command>]


See Also

DOSERROR(), DISPLAY CALLS, ERRNO(), ERROR(), LIST CALLS, MESSAGE(), ON ESCAPE, ON KEY, PROCLINE(), PROCNAME(), RETRY, 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 Recital behavior will be restored. By default, Recital will stop execution at the error and an error.mem file will be created

<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.


Example

procedure badfile
  on error
  set message to "File does not exist."
return to master
 
on error do badfile
use patrons


Products

Recital Server, Recital