Precedence of CATCH blocks
- Last Updated: October 18, 2024
- 1 minute read
- OpenEdge
- Version 12.2
- Documentation
In general, the AVM performs error handling using this precedence, from highest to lowest. The AVM only abides by one of these when a condition is raised:
- Statement
NO-ERRORoption CATCHblock- Block’s
ONphrase (explicit or implicit)
Using NO-ERROR on a statement prevents a CATCH block
from running if the statement raises a condition.
Otherwise a CATCH block takes precedence over any flow of control directive on
the block, for example, LEAVE or THROW. See sections
on Default Condition Handling and Block Flow of Control and Condition Directives, for more
information on block condition directives.
If there are CATCH blocks, but none of them
are compatible with the type of condition that occurs, then the ON phrase for the block takes effect. This could be an explicit or
implicit (default) phrase for the block type, such as ON
ERROR or ON STOP. It can be useful to have
both an explicit ON phrase for the associated block and
a CATCH on the same associated block. You might want to
CATCH certain error types and handle them directly,
and have all other condition types handled by the ON
phrase of the associated block.