(rontolisp) docs
← Macros

define-condition

(define-condition name (parent...) (slot...) option...)

Defines a condition type as a CLOS-subset class (see defclass) over the built-in condition hierarchy condition > serious-condition > error (> simple-error and the standard error subtypes) and warning. The parent defaults to condition; with several parents, the first provides the slot layout (single inheritance) and the rest join the type hierarchy for typep/typecase/handler-case matching only (their slots are not inherited). Slots use the defclass subset (:initarg/:initform/:reader/:accessor, plus :documentation, which is dropped). Of the class options, (:report x) — a literal string or a (lambda (condition stream) ...) — is used as the message when the condition is signaled by error/signal, and (:documentation ...) is dropped. Returns the type name. On the compile path it is a top-level-only form, like defclass.

> (error 'my-parse-error :input "x")
Error: input did not parse