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, a (lambda (condition stream) ...) or a symbol naming such a function — is the condition's REPORT: it is the message when the condition is signaled by error/signal/warn and the text princ, princ-to-string and format's ~A write for the condition object. prin1 / ~S are unaffected and keep the #<TYPE :SLOT value ...> instance syntax. The report runs where its text is read, never at the signal: a condition caught without being printed runs none, and an uncaught one whose report itself fails reports #<error printing a TYPE: ...>. A type that defines no :report inherits its parent's; a type that inherits none but carries the simple-condition slots (format-control/format-arguments, i.e. any subtype of simple-error/simple-warning/simple-condition) reports through format applied to them; a type with neither keeps the #<...> rendering under princ too. A print-object method on the type wins over the report, for both escape modes. (:default-initargs :initarg value ...) forwards to the generated class (defaults applied by make-condition/typed error for initargs not supplied), and (:documentation ...) is dropped. Returns the type name. On the compile path one below the top level defines its type where it runs, like a defclass there.
The report is what princ/~A prints; prin1/~S still shows the instance:
A standard class a program signals itself reports what the built-in signal of that class says, from the slots it was given: undefined-function, unbound-variable, type-error, division-by-zero and their subclasses.
CL-USER> (error 'my-parse-error :input "x")
Error: input did not parse