Try OpenEdge Now
skip to main content
Error Handling
Using FINALLY End Blocks : Behavior : Transaction scope in a FINALLY block
 

Transaction scope in a FINALLY block

The transaction of the associated block is either complete (success) or undone (failure) when FINALLY executes. Therefore, any UNDO statement within the FINALLY block will only undo the work in the FINALLY block.
The FINALLY block is an undoable block with implicit ON ERROR UNDO, THROW error handling. You cannot explicitly override the ON ERROR directive for a FINALLY block. If a statement within the FINALLY block raises ERROR, the FINALLY block will be undone, and ERROR will be raised in the block that encloses the associated block of the FINALLY block. Error is not raised in the associated block. Otherwise, infinite looping could occur.
A statement that raises ERROR within a FINALLY end block causes the following to occur:
1. UNDO the FINALLY block
2. LEAVE the associated block
3. THROW the error to the block enclosing the associated block
The same behavior occurs for an explicit THROW statement in a FINALLY block.