Handle the error
- Last Updated: October 17, 2024
- 1 minute read
- OpenEdge
- Version 12.8
- Documentation
The ERROR-STATUS system handle allows you to test whether any error
occurs and whether a particular error occurs. You can have a branch that executes
for a particular error, and you can have another branch that executes for any other
error.
The attributes and methods of the handle allow you to access the error message strings and error numbers. If specific errors are important to you, the error numbers are useful. But more often than not, you are simply interested in whether an error occurs.
The following table describes the significant attributes and methods of the
ERROR-STATUS system handle.
| Attribute or method | Description |
ERROR attribute |
If the ABL statement uses the NO-ERROR
option and the AVM raises the ERROR
condition, this attribute is set to TRUE. Some handle methods may generate
an error message but not raise |
ERROR-OBJECT-DETAIL attribute |
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. |
The following example illustrates using the FIND statement with NO-ERROR:
|
For the FIND statement in particular, there is
another way to do this. When the FIND statement fails,
the buffer is left with no record in it. Therefore, you can use the built-in AVAILABLE function to determine if the FIND failed. In this case, we don’t use the information in
the ERROR-STATUS system handle, but still use NO-ERROR to prevent the error message from displaying.
|