Nested Exceptions

A nested exception is an exception that occurs while another exception is being handled.

When this happens:
  • Processing of the first exception is temporarily suspended.
  • The system saves all of the associated information such as the locations of the handle cursor and resume cursor.
  • Exception handling begins again with the most recently generated exception.
  • New locations for the handle cursor and resume cursor are set by the system.
  • Once the new exception has been properly handled, handling activities for the original exception normally resume.
When a nested exception occurs, both of the following are still on the call stack:
  • The call stack entry associated with the original exception
  • The call stack entry associated with the original exception handler

To reduce the possibility of exception handling loops, the system stops the percolation of a nested exception at the original exception handler call stack entry. Then the system promotes the nested exception to a function check message and percolates the function check message to the same call stack entry.

If the nested exception or the function check message is not handled, the application comes to an abnormal end. In this case, message CEE9901 is sent to the caller of the control boundary.

If you move the resume cursor while processing the nested exception, you can implicitly modify the original exception. To cause this to occur, do the following:
  1. Move the resume cursor to a call stack entry that was promoted earlier than the call stack entry that incurred the original exception.
  2. Resume processing by returning from your handler.