Introduction to FINALLY blocks
- Last Updated: March 30, 2020
- 1 minute read
- OpenEdge
- Version 12.2
- Documentation
The FINALLY statement creates an end block
that executes once at the end of each iteration of its associated block, regardless of whether
the associated block executed successfully or raised a condition.
The FINALLY block executes after:
- Successful execution of the associated block.
- Each successful iteration of an iterating associated block.
-
ERRORorSTOPis raised in the associated block regardless of whether aCATCHblock orONphrase handles the condition.
The FINALLY block does not execute if:
- A
QUITstatement is in effect and it is not handled.
Since a FINALLY block executes after an invoked
CATCH block, it can also be used to perform common
post-CATCH cleanup tasks, rather than repeating common code in all the
CATCH blocks present in the associated block.