Skip to main content

serious-condition

serious-condition Condition Type

Class Precedence List:

serious-condition, condition, t

Description:

All conditions serious enough to require interactive intervention if not handled should inherit from the type serious-condition. This condition type is provided primarily so that it may be included as a superclass of other condition types; it is not intended to be signaled directly.

Notes:

Signaling a serious condition does not itself force entry into the debugger. However, except in the unusual situation where the programmer can assure that no harm will come from failing to handle

a serious condition, such a condition is usually signaled with error rather than signal in order to assure that the program does not continue without handling the condition. (And conversely, it is conventional to use signal rather than error to signal conditions which are not serious conditions, since normally the failure to handle a non-serious condition is not reason enough for the debugger to be entered.)

Expanded Reference: serious-condition

The serious-condition Type

serious-condition represents conditions serious enough that they should not be ignored if unhandled. error is a subtype of serious-condition. The serious-condition type sits between condition and error in the hierarchy.

(subtypep 'serious-condition 'condition)

=> T
=> T
(subtypep 'error 'serious-condition)

=> T
=> T

Handling Serious Conditions

You can catch all serious conditions (not just errors) by handling serious-condition.

(handler-case (error "Something bad")
(serious-condition (c)
(format nil "Serious: ~A" c)))

=> "Serious: Something bad"

Type Checking

(typep (make-condition 'simple-error :format-control "test") 'serious-condition)

=> T
;; Warnings are NOT serious conditions
(typep (make-condition 'simple-warning :format-control "test") 'serious-condition)

=> NIL