Try OpenEdge Now
skip to main content
Error Handling
Using Structured Error Handling : Additional language features
 

Additional language features

ABL structured error handling uses the following language elements:
*An extensible hierarchy of classes to allow OpenEdge system errors and your custom application errors to be expressed as objects.
*The UNDO, THROW directive with the ON ERROR phrase to allow you to throw unhandled (uncaught) errors to the next outer block in the call stack. This feature also allows you to easily throw errors outside of a block. This is a significant enhancement to the flexibility of ABL error handling.
*The THROW option to the UNDO statement. This option is your tool for generating and throwing custom application errors. (You cannot explicitly generate an OpenEdge system error, but you can re-throw one with this option.)
*Two statements that change default behavior in the containing file from traditional to structured error handling. The first of these statements, BLOCK-LEVEL ON ERROR UNDO, THROW, causes all blocks that have no explicit error directive and are subject to default error handling to use the UNDO, THROW directive (replacing UNDO, RETRY or UNDO, LEAVE). The second statement, ROUTINE-LEVEL ON ERROR UNDO, THROW, has the same effect on routine-level blocks but does not change the default behavior for other blocks. See THROWas a default for blocks.
*The compile-time startup parameter -undothrow n to enable you to implement the behavior associated with BLOCK-LEVEL ON ERROR UNDO, THROW or ROUTINE-LEVEL ON ERROR UNDO, THROW for an entire application, rather than on a per-file basis. See the OpenEdge Deployment: Startup Command and Parameter Reference for more information on -undothrow.
*A CATCH statement, used to define an error-handling end block that is associated with an error type and any undoable ABL block.
*A new end block with the FINALLY statement. The FINALLY statement lets you define an end block that must execute at the end of an ABL block (or each iteration) whether the block executed successfully or raised an error. The FINALLY block also executes after a CATCH block, if one exists.
*Class-based error objects can be thrown from an AppServer to an ABL client. For the criteria an error object must satisfy to be thrown from server to client, see Throwing class-based error objects from an AppServer to an ABL client.