Common Lisp the Language, 2nd Edition

Next: Non-Serious Conditions Up: Survey of Concepts Previous: Interactive Condition Handling

## 29.3.12. Serious Conditions

The `ignore-errors` macro will trap conditions of type `error`. There are, however, conditions that are not of type `error`.

Some conditions are not considered errors but are still very serious, so we call them serious conditions and we use the type `serious-condition` to represent them. Conditions such as those that might be signaled for ``stack overflow'' or ``storage exhausted'' are in this category.

The type `error` is a subtype of `serious-condition`, and it would technically be correct to use the term ``serious condition'' to refer to all serious conditions whether errors or not. However, normally we use the term ``serious condition'' to refer to things of type `serious-condition` but not of type `error`.

The point of the distinction between errors and other serious conditions is that some conditions are known to occur for reasons that are beyond the scope of Common Lisp to specify clearly. For example, we know that a stack will generally be used to implement function calling, and we know that stacks tend to be of finite size and are prone to overflow. Since the available stack size may vary from implementation to implementation, from session to session, or from function call to function call, it would be confusing to have expressions such as `(ignore-errors (+ a b))` return a number sometimes and `nil` other times if `a` and `b` were always bound to numbers and the stack just happened to overflow on a particular call. For this reason, only conditions of type `error` and not all conditions of type `serious-condition` are trapped by `ignore-errors`. To trap other conditions, a lower-level facility must be used (such as `handler-bind` or `handler-case`).

By convention, the function `error` is preferred over `signal` to signal conditions of type `serious-condition` (including those of type `error`). It is the use of the function `error`, and not the type of the condition being signaled, that actually causes the debugger to be entered.

Compatibility note: The Common Lisp Condition System differs from that of Zetalisp in this respect. In Zetalisp the debugger is entered for an unhandled signal if the `error` function is used or if the condition is of type `error`.

Next: Non-Serious Conditions Up: Survey of Concepts Previous: Interactive Condition Handling