Common Lisp the Language, 2nd Edition

next up previous contents index
Next: Resignaling Conditions Up: Survey of Concepts Previous: Condition Types

29.3.15. Signaling Conditions

When a condition is signaled, the system tries to locate the most appropriate handler for the condition and to invoke that handler.

Handlers are established dynamically using handler-bind or abstractions built on handler-bind.

If an appropriate handler is found, it is called. In some circumstances, the handler may decline simply by returning without performing a non-local transfer of control. In such cases, the search for an appropriate handler is picked up where it left off, as if the called handler had never been present.

If no handler is found, or if all handlers that were found decline, signal returns nil.

Although it follows from the description above, it is perhaps worth noting explicitly that the lookup procedure described here will prefer a general but more (dynamically) local handler over a specific but less (dynamically) local handler. Experience with existing condition systems suggests that this is a reasonable approach and works adequately in most situations. Some care should be taken when binding handlers for very general kinds of conditions, such as is done in ignore-errors. Often, binding for a more specific condition type than error is more appropriate.