Skip to main content

simple-error

simple-error Condition Type

Class Precedence List:

simple-error, simple-condition, error, serious-condition, condition, t

Description:

The type simple-error consists of conditions that are signaled by error or cerror when a format control is supplied as the function’s first argument.

Expanded Reference: simple-error

The simple-error Type

simple-error is the default condition type signaled by error when a format string is passed. It inherits from both simple-condition and error.

(subtypep 'simple-error 'error)

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

=> T
=> T

Created Implicitly by error

(handler-case (error "File ~A not found" "test.txt")
(simple-error (c)
(format nil "~A" c)))

=> "File test.txt not found"

Creating Directly with make-condition

(let ((c (make-condition 'simple-error
:format-control "Expected ~S, got ~S"
:format-arguments '(integer "hello"))))
(simple-condition-format-control c))

=> "Expected ~S, got ~S"