Try OpenEdge Now
skip to main content
Error Handling
Raising errors with THROW : THROW as a default for blocks : ROUTINE-LEVEL ON ERROR UNDO, THROW statement
 

ROUTINE-LEVEL ON ERROR UNDO, THROW statement

The ROUTINE-LEVEL ON ERROR UNDO, THROW statement is very similar to BLOCK-LEVEL ON ERROR UNDO, THROW, but it affects only a subset of block types: the main blocks of ABL routines. Specifically, this statement changes the default behavior for the following blocks:
*Procedure (also called main block, external procedure, or .p file)
*Internal procedure
*Database trigger (ON block with CREATE, DELETE, WRITE, or ASSIGN event)
*User-defined function
*Constructor
*User-defined method
*Property accessor
The following blocks are not affected:
*Any block for which an error-handling directive is explicitly specified
*REPEAT
*FOR
*DO TRANSACTION
*Simple DO block
*Destructor
*UI trigger

Syntax

ROUTINE-LEVEL ON ERROR UNDO, THROW.
The same rules that affect the placement of the BLOCK-LEVEL ON ERROR UNDO, THROW statement also apply to ROUTINE-LEVEL ON ERROR UNDO, THROW:
*The statement occurs once in each .p or .cls file in which the behavior is desired.
*The statement must come before any definitional or executable statement in the procedure or class file.
*The statement can come before or after a USING statement.
Note: The ROUTINE-LEVEL ON ERROR UNDO, THROW statement is ignored if BLOCK-LEVEL ON ERROR UNDO, THROW occurs in the same file.