Try OpenEdge Now
skip to main content
Error Handling
Introduction to Condition Handling : Traditional error handling : Default error handling
 

Default error handling

Default error handling is defined at the block level and is considered a property of the block. It can vary depending on the block type and whether the work inside the block is part of a transaction. Consider this single line procedure:
FIND FIRST Customer WHERE CustNum = 1000.
This statement will fail since the Sports2000 database does not contain a matching Customer record. When it fails, the AVM performs the following steps:
1. The AVM stops execution of the block at the failed statement.
2. The AVM displays a message (like the one shown) to the default output destination, which is usually the screen:
3. The AVM checks the block that encloses the failed statement to get the default error handling instructions.
4. Error handling always begins with the UNDO action. The AVM undoes any changes to undoable variables and temp-table fields. Variables and temp-table fields are undoable by default unless they were defined with the NO-UNDO option. The AVM also undoes the current transaction, if one exists. A transaction exists if the block :
*Can change database fields
*Has the TRANSACTION keyword in the block header statement
*Is a sub-block of a block that is itself a transaction.
See the chapter on transactions in OpenEdge Getting Started: ABL Essentials to review transaction fundamentals.
In this example, there is nothing that needs to be undone.
5. The AVM attempts the default branching option. This could be RETRY, LEAVE, or NEXT, depending on the context. (Branching options are described fully in TraditionalError Handling. In this example, the branching option is LEAVE.
6. The AVM terminates the procedure and returns to the operating system or the OpenEdge tool from which the procedure was run.