Try OpenEdge Now
skip to main content
GUI for .NET Programming
Accessing and Managing .NET Classes from ABL : Handling .NET exceptions
 

Handling .NET exceptions

.NET error handling is based on a structured error handling model that encapsulates each error by an object type referred to as an exception. The base class for all .NET exceptions is System.Exception, and ABL allows you to trap System.Exception and all of its derived .NET Exception objects in much the same way as you trap ABL error objects.
In order to trap and handle .NET Exception objects in common with ABL error objects, OpenEdge has enhanced the .NET System.Exception class to implement the Progress.Lang.Error interface. Implementing this interface allows you to handle all .NET exceptions that are raised in the ABL context by both traditional and structured ABL error handling constructs.
If you use traditional error handling, you can trap a .NET exception raised from accessing .NET objects in a given block, and raise that exception to the next enclosing block, as with any ABL error.
If you use structured error handling, you can catch and throw a .NET Exception object and consult the same properties and methods as for a Progress.Lang.ProError object. However, these extended OpenEdge properties and methods function a little differently for a .NET exception than for an ABL error.
For more information on:
*The properties and methods available on .NET Exception objects, see Using properties and methods on .NET Exception objects.
*Differences in handling .NET exceptions compared to ABL errors, see Unique scenarios when handling errors with .NET objects.
* Using the ABL error trapping constructs
* Using properties and methods on .NET Exception objects
* Unique scenarios when handling errors with .NET objects