Handle Errors
- Last Updated: April 3, 2023
- 3 minute read
- OpenEdge
- Version 12.2
- Documentation
.NET developers can process ABL error objects as .NET exceptions. To enable .NET proxies to throw these exceptions, OpenEdge establishes the following exception class hierarchies:
-
General ABL exceptions — A hierarchy of exception classes that extend
the
Open4GLExceptionclass.Open4GLException, in turn, extends theProExceptionclass. -
DataSet/DataTable exceptions — A
ProDataExceptionclass that extends the standardSystem.Data.DataExceptionclass.
For a complete object hierarchy see Exception class hierarchy. To learn more about error handling in ABL code, see ABL Error Handling.
Explore RunTime4GLErrorException class
TheRuntime4GLErrorException class hierarchy is shown here.
|
PUBLIC properties are available for
classes that inherit from Runtime4GLErrorException class.
CallStackprovides details including the file and line number that threw the error.NumMsgsprovides the number of error messages.Severityprovides ABL developers a way to rank their application error objects according to a severity scheme.
PUBLIC methods are available for classes
that inherit from Runtime4GLErrorException class. GetMessage (int)retrieves the message.GetMessageNum (int)retrieves the message number for lookup.
Access CallStack information
System administrators must enable the ability to store CallStack information during the testing phase. This allows errors to send the file and line number where errors occurred.- Edit the
openedge.propertiesfile.- Locate the
AppServer.SessMgrproperties. - Add
-errorstackto theagentStartupParamproperty.[AppServer.SessMgr] ... agentStartupParam=-T "${catalina.base}/temp" -errorstack ...
- Locate the
- Save.
CallStack
details.
|
Runtime system error condition
In this example, a call made from .NET to the poorly written ABL code raises a runtime system error when the procedure attempts to use theint() function on a character.
|
In the .NET client, the exception provides a return message
that identifies the issue. The return message is RunTime4GLErrorException.ERROR condition: Invalid character in numeric input a. (76)
(7211). The invalid character in a numeric input a (76)
(7211), identifies the problem in the ABL code.
RunTime4GLErrorException that can help determine how to process the
exception.Throw an application error
ABL developers can explicitly throw an error to .NET developers. This
procedure shows the type of statements needed to throw an error. In the ABL code, developers
would use an
.NET developers can determine how to handle the exception in the.NET code with
the information provided in the exception's message.
UNDO, THROW appErr where appErr is of type Progress.lang.App that maps to the .NET RunTime4GLAppErrorException exception . In this example, the ABL developer uses
the AppError object to store a custom message that
provides additional details to the .NET developers.
|
Explore Runtime4GLException class
TheRuntime4GLException
class hierarchy is shown here.
|
PUBLIC properties are available for
classes that inherit from Runtime4GLException class. hasProcReturnStringflags existence of a return string.ProErrorNumerror numberProcReturnStringget a custom return string
Return custom ProcReturnString
Prior to the addition of the application error,
developers may have used the
ProcReturnString to customize
an error string. ABL developers can use RETURN ERROR with a
custom ProcReturnString to communicate information to .NET
developer.
|
The exception that is thrown is
.NET developer can determine how to handle the exception on the.NET side
based on the custom value returned. The .NET developer can then display or process the custom
string.Progress.Open4GL.Exceptions.RunTime4GLAppErrorException: Error condition: The Server
application has returned an error. (7243) (7211). The .NET developer can access
the custom message ProcReturnString.
|
|
Stop conditions
In this example, an ABL procedure callednon-existent.p is not found in the PROPATH.
|
non-existent.p
raises a STOP condition and returns an exception. The return
message is Progress.Open4GL.Exceptions.RunTime4GLStopErrorException:
** “non-existent.p” was not found (293) (7211). The message,“non-existent.p” was not found . The exception indicates that the errors is a
RunTime4GLStopErrorException which allows the .NET
developer to code for that exception.