5.1.2 Exception-Handling Overview

When an exception occurs (is raised), the normal flow of control in the current thread is interrupted, the context is saved, and control is transferred to the exception-handling support code. This support code marshals the exception information and then enters a section of the support code called the exception dispatcher. The exception dispatcher searches for exception handlers and invokes them in the proper sequence.

When a handler is invoked, it is called as a procedure with arguments that describe the nature of the exception, the environment within which the exception was raised, and the environment within which the handler was established. When the handler is called the exception is said to be delivered to the handler.

The handler may respond to the exception in several ways, including various combinations of the following:

When an exception handler has finished processing an exception, it must indicate this in one of the following ways:

All exceptions are handled with the same interfaces, data structures, and algorithms. That is, there is unified exception handling for all kinds of exceptions, regardless of their origination.

Each exception has an exception value that identifies the exception (such as subscript range violation, or memory access control violation). Exceptions may also have associated with them one or more exception qualifiers (such as the name of an array and the subscript that was out of range, or an address associated with a memory access control violation).