ABL conditions
- Last Updated: March 30, 2020
- 3 minute read
- OpenEdge
- Version 12.2
- Documentation
Generally speaking, a condition differs from other run-time events in that it is unexpected and requires a response to restore application flow. In ABL, a condition always invokes a default response, which is called default error handling.
Default error handling protects your database while also providing branching options to restore application flow. You design your ABL application to accept default error handling, or to replace it with custom error handling.
ABL recognizes these four conditions, all of which are keywords:
-
ERRORAn
ERRORoccurs when:- The AVM fails to execute an ABL statement. For example, if a
FINDstatement fails to find a matching record, then the statement fails. These failures are detected at run time by the AVM which then raises theERRORcondition. These errors are known as system errors. A system error is associated with a number and a descriptive message. - Your application executes the
RETURN ERRORstatement or throws an instance ofProgress.Lang.AppError. An error raised in this way is called an application error. - An application uses the
APPLY "ERROR"statement. This is considered outdated functionality.
In all cases, when an error condition is raised in a block with error handling, it is not raised again beyond that block unless some ABL code explicitly instructs the AVM to do so. In other words, the default is that errors are local and are not propagated beyond the current block context.
- The AVM fails to execute an ABL statement. For example, if a
-
STOPThe
STOPcondition represents a more serious condition and occurs when:- The AVM encounters a system error that is deemed more serious or
unrecoverable. For example, if the AVM detects a lost database connection, the AVM
raises the
STOPcondition. - Your application executes a
STOPstatement. - An application user presses the key mapped to the
STOPkey code when input is enabled. By default, this is CTRL+C on Unix/Linux or CTRL+Break in Windows. - The specified time has expired when using a
STOP-AFTERphrase on a block. - A record lock conflict occurs and the user either cancels out of the
ensuing record lock conflict dialog, or there is no user response (including in batch
mode) within the time specified by the
-lkwtmostartup parameter.
In all cases, when a
STOPcondition is raised in a block, it is then raised again in all blocks up the call stack unless it is handled by explicit ABL code. In other words, the default is thatSTOPconditions propagate up the call stack indefinitely until the application ends. In addition, there are a few cases where the AVM ignores explicit attempts to handle aSTOPcondition, until either the current transaction is over or until the AVM has returned up past the code layer that accesses the database, depending on the condition. - The AVM encounters a system error that is deemed more serious or
unrecoverable. For example, if the AVM detects a lost database connection, the AVM
raises the
-
QUITThe
QUITcondition only occurs when your application executes aQUITstatement. It causes any open transaction to be committed and the AVM session to terminate. As the AVM unwinds the stack, theQUITcondition is in effect. -
ENDKEYThe
ENDKEYcondition occurs when:- An application user presses a key that is mapped to the
ENDKEYkey code (typically ESC) when input is enabled. This has different default behavior depending on the context. For example, it may back out editing entered by a user in an ABL widget, or it may close the current window if no editing is taking place. This style of user interface was designed for character mode applications and is no longer relevant to most modern applications. - The application reaches the end of an input stream.
- An application user presses a key that is mapped to the