Try OpenEdge Now
skip to main content
Error Handling
Using ABL Error Classes : Progress.Lang.AppError class : Properties and methods
 

Properties and methods

Properties and methods table describes the properties and methods inherited by this class. The following table describes the additional properties and methods of AppError.
Table 12. AppError properties and methods
Member
Description
ReturnValue property
An AppError object can be used to replace RETURN ERRORerror-data-string statements used in traditional error handling. In traditional error handling, you can use the RETURN-VALUE function in the caller to access the error-data-string. The ReturnValue property provides parallel functionality when you use a RETURN ERRORAppError-object-expression statement in structured error handling. The error-data-string is available in both the RETURN-VALUE function and the ReturnValue property in the caller.In fact, when the AVM detects RETURN ERRORerror-data-string statement, it creates an AppError object and populates the ReturnValue property so that the caller can handle the RETURN ERROR with a CATCH block.
Severity property
Although the Severity property is an inherited property, it is intended as a feature of AppError objects and is not used by SysError objects. Severity has no intrinsic meaning to ABL. You can use it to establish a severity ranking system in your applications.
AddMessage( ErrorMessage, MessageNumber ) method
Adds a message to the AppError object with the values from the ErrorMessage and MessageNumber arguments to the end of the message list. Your application provides the message number and text. Access error messages and message numbers with the GetMessage( ) and GetMessageNum( ) methods. This method increments the NumMessages property on the AppError by 1.When you create an AppObject with a constructor, you populate the object with the first error message. You can add more messages to the object with this method. As messages are added, the NumMessages property is automatically updated.
RemoveMessage( MessageIndex ) method
Removes the indexed error (both error message string and error message number) from the message list. The method decrements the NumMessages property by 1 and moves the messages after the indexed error forward in the list by 1. For example, if there are five messages in the AppError object list of messages, and the RemoveMessage method has a MessageIndex of 3, then the method removes message three. It also updates message four to be message three, and message five to be message four. Finally, it sets NumMessages to 4.