Signaling and Handling Conditions (original) (raw)

ANSI Common Lisp 9 Conditions 9.1 Condition System Concepts

9.1.4 Signaling and Handling Conditions

The operation of the condition system depends on the ordering of active applicable handlers from most recent to least recent.

Each handler is associated with a type specifierthat must designate a subtype of type condition. A handleris said to be applicable to a condition if thatcondition is of the type designated by the associatedtype specifier.

Active handlers are established by using handler-bind (or an abstraction based on handler-bind, such as handler-case or ignore-errors).

Active handlers can be established within the dynamic scope of other active handlers. At any point during program execution, there is a set of active handlers. When a condition is signaled, the most recent active _applicable handler_for that condition is selected from this set. Given a condition, the order of recentness of active applicable handlers is defined by the following two rules:

Once a handler in a handler binding form (such as handler-bind or handler-case) has been selected, all handlers in that form become inactive for the remainder of the signaling process. While the selected handler runs, no other handler established by that form is active. That is, if the handler declines, no other handler established by that form will be considered for possible invocation.

The next figure shows operators relating to the handling of conditions.

Operators relating to handling conditions.

handler-bind handler-case ignore-errors

9.1.4.1 Signaling
9.1.4.2 Restarts