error
(error datum args...)
Signals an error, aborting execution unless an enclosing handler-case catches it. The Common Lisp condition designators are supported:
(error "control" args...)— the control string must be a literal using the same directives asformat(~a,~s,~%, ...); the remaining arguments fill them to build the message.(error 'type :initarg value ...)— constructs a condition instance of the named class (built-in or defined bydefine-condition) and signals it. The message is the class's:reportrendering when one is defined, and theCondition (type initargs...) was signalled.shape otherwise; for thesimple-*classes a supplied:format-controlbecomes the message.(error obj)— signals a pre-built condition object (e.g. frommake-condition); a value that turns out to be a string at runtime is signaled as a plain message.
The interpreter and JVM backends throw an exception carrying the message and the condition object, so handler-case can dispatch on its type; the WASM backend traps (uncatchable). Like format, error is a macro with no function value, so #'error is unsupported.
Because an uncaught error aborts execution it is shown here statically rather than as a runnable example:
(error "bad value: ~a" x)
(error 'type-error :datum x :expected-type 'integer)