Error handling for handle method calls

Traditionally, ABL handle methods treat errors as warnings and do not raise the ERROR condition. Therefore, statements calling handle methods should use the NO-ERROR option to capture error messages in the ERROR-STATUS system handle. If an error occurs in the handle method and NO-ERROR is in effect, the ERROR-STATUS:ERROR attribute is not set, but you can test to see if ERROR-STATUS:NUM-MESSAGES is greater than zero.

However, if a handle method error occurs in a block that contains a CATCH end block, the AVM does raise the ERROR condition. The error then needs to be handled by a CATCH block, with an appropriate ON ERROR phrase or ROUTINE-LEVEL ON ERROR UNDO, THROW statement to override the default error handling for the block type, if necessary.

When a statement contains the NO-ERROR option and resides in a block with a CATCH end block, the NO-ERROR option takes precedence over the CATCH block. That is, an error raised on the statement with the NO-ERROR option will not be handled by a compatible CATCH end block. The error is redirected to the ERROR-STATUS system handle as normal.

If an error object is thrown to a statement that includes the NO-ERROR option, the information and messages in the error object will be used to set the ERROR-STATUS system handle. This interoperability feature is important for those integrating code that uses the traditional NO-ERROR technique with the newer, structured error handling that features error objects and CATCH end blocks.