Handling Exceptions

From InterBase
Jump to: navigation, search

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 WHEN statement that handles the exception. If one is not found, it terminates execution of the BEGIN END block containing the exception and undoes any actions performed in the block.
  • Backs out one level to the surrounding BEGIN END block and seeks a WHEN statement that handles the exception, and continues backing out levels until one is found. If no WHEN statement is found, the procedure is terminated and all its actions are undone.
  • Performs the ensuing statement or block of statements specified by the WHEN statement that handles the exception.
  • Returns program control to the block in the procedure following the WHEN statement.
Note: An exception that is handled does not return an error message.

Advance To: