Understanding exceptions

Exceptions are abnormal runtime events that can be trapped for control.

If an instruction executes abnormally, the runtime system throws exceptions that can be handled by the program.

Specific exception actions can be taken based on the class of the exception.

Runtime errors (exceptions) can be trapped by a WHENEVER exception handler or by a TRY/CATCH block. The WHENEVER exception is provided for compatibility with Informix 4GL, consider using TRY/CATCH blocks instead.

If an exception is thrown by a method or function that can be used in an expression (an typically returns an object), this exception cannot be handled with WHENEVER ERROR CALL / CONTINUE. In such case, only a TRY/CATCH block can be used to handle exceptions.

Some specific errors such as error -1338 cannot be trapped. In such case, the program will always stop and show the error, even if a WHENEVER exception handler or TRY/CATCH block is used.

A Genero exception is identified by its number and has a description. For a complete list of BDL errors, see Genero BDL errors.

Exception handlers are typically used to detect database errors when executing SQL statement. For more details, see SQL execution diagnostics