Block Flow of Control and Condition Directives
- Last Updated: October 18, 2024
- 1 minute read
- OpenEdge
- Version 12.2
- Documentation
Block Flow of Control and Condition Directives
The
ON phrase is one of the ABL constructs used for altering the default error
handling for basic blocks. For information on default error (condition) handling see
Default Condition Handling. There is a variation of the ON
phrase to control each of the ABL conditions:ON ERROR…ON STOP…ON QUIT…ON ENDKEY…
The ON phrase can be used on the following blocks:
| Block type | Examples |
DO(This includes all |
DO ON STOP UNDO, LEAVE:
|
FOR EACH |
FOR EACH Order ON ERROR UNDO, NEXT: |
REPEAT |
REPEAT ON QUIT UNDO, LEAVE: |
There can be multiple
ON phrases on the same block, separated by white
space. For example:
|
You cannot modify the error action on other blocks using the ON phrase.
This includes:
- Procedures (top-level or internal)
- User-defined methods
- User-defined property getter/setter blocks
- Constructors/destructors
- User-defined functions
- UI trigger blocks
- Database triggers (
ONblock withCREATE,DELETE,WRITE, orASSIGNevent)
However, there is a way to change the default error handling for most of these blocks, at a block or routine level. This is described in the section on Use UNDO, THROW.