Try OpenEdge Now
skip to main content
Error Handling
Traditional Error Handling : Providing custom error handling

Providing custom error handling

The NO-ERROR option redirects errors to the ERROR-STATUS system handle. The handle preserves each system error message raised by a statement with the NO-ERROR option. The handle preserves this information only until the AVM executes another statement with the NO-ERROR option, whether or not an error occurred on the subsequent statement.
The ERROR-STATUS system handle allows you to test whether any error occurred or whether a particular error occurred. You could have a branch that executes when a particular error occurs, and you could have another branch that executes when any other error occurs.
The attributes and methods of the handle allow you to make specific tests. If specific errors are important to you, the error numbers of the error message will be useful to you. If you need to repackage the standard error string to output it to a log file or other alternate destination, you can retrieve this information as well.
The following table describes the significant attributes and methods of the ERROR-STATUS system handle.
Table 5. ERROR-STATUS system handle attributes and methods
Attribute or method
ERROR attribute
If the ABL statement uses the NO-ERROR option and the AVM raises the ERROR condition, then this attribute is set to TRUE.If a method on an ABL system object generates an error message, the AVM does not raise error and this attribute remains FALSE. ABL treats built-in method errors as warnings rather than true errors.
If a Web service method returns a SOAP fault, the AVM stores the SOAP fault information in an ABL SOAP-fault object and raises ERROR. The AVM stores a handle reference to the SOAP-fault object in this attribute.
NUM-MESSAGES attribute
Provides an integer count of all the error messages generated by the statement with the NO-ERROR option.
GET-MESSAGE( index ) method
Allows you to retrieve the specified error string. The index runs from 1 to the value of NUM-MESSAGES.
GET-NUMBER( index ) method
Allows you to retrieve the specified error number. The index runs from 1 to the value of NUM-MESSAGES.
* Testing for statement errors
* Testing for built-in method warnings