Default condition handling exists for any condition that occurs in an application. This is explained in more detail in Default Condition Handling. However for most applications, the default handling does not provide the most desirable way to control program flow or show error messages in a user-friendly manner. Therefore, most applications customize how conditions are handled.

Below is a summary of the various ABL constructs that can be used to customize condition handling. Each is discussed in more detail in later sections.

  • The NO-ERROR keyword — This is useful when an error is expected on a single statement and there is a specific programmatic way of handling it.
  • The ON phrase on a block — This includes ON ERROR, ON STOP, ON QUIT, and ON ENDKEY. These are used to determine program flow after an unexpected condition, or to throw the condition to a higher level to be handled there.
  • CATCH blocks — This is the most desirable way to deal with unexpected ERROR and STOP conditions. It gives the program access to error information so that it can be reported in a customized way.
  • Error objects — The ABL provides a set of built-in objects representing ERROR or STOP conditions, which can be caught. In addition, applications can create their own application error objects that can be thrown and may provide extra contextual information.
  • The UNDO, THROW statement — This is a way to rethrow a caught error or stop object, or throw an application error object.
  • FINALLY blocks — This is not specifically about handling conditions. However, it allows you to write code that always runs at the end of a block, whether a condition occurs in that block or not.