Handling Exceptions
From InterBase
Go Up to Handling Errors
Instead of terminating when an exception occurs, a procedure can respond to and perhaps correct the error condition by handling the exception. When an exception is raised, it does the following:
- Seeks a
WHENstatement that handles the exception. If one is not found, it terminates execution of theBEGIN … ENDblock containing the exception and undoes any actions performed in the block. - Backs out one level to the surrounding
BEGIN … ENDblock and seeks aWHENstatement that handles the exception, and continues backing out levels until one is found. If noWHENstatement is found, the procedure is terminated and all its actions are undone. - Performs the ensuing statement or block of statements specified by the
WHENstatement that handles the exception. - Returns program control to the block in the procedure following the
WHENstatement.
Note:
An exception that is handled does not return an error message.
An exception that is handled does not return an error message.