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

BLOCK-LEVEL ON ERROR UNDO, THROW statement

The BLOCK-LEVEL ON ERROR UNDO, THROW statement changes the default implicit ON ERROR phrase to ON ERROR UNDO, THROW for every supported block type in the file that contains the statement. The following blocks are affected by this statement:
*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
*REPEAT
*FOR
*DO TRANSACTION
The following blocks are not affected:
*Any block for which an error-handling directive is explicitly specified
*Simple DO block
*Destructor
*UI trigger

Syntax

BLOCK-LEVEL ON ERROR UNDO, THROW.
The following rules affect the placement of the BLOCK-LEVEL ON ERROR UNDO, THROW statement:
*The statement occurs once in each source 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.
* Example