Skip to main content

package-error

package-error Condition Type

Class Precedence List:

package-error, error, serious-condition, condition, t

Description:

The type package-error consists of error conditions related to operations on packages. The offending package (or package name) is initialized by the :package initialization argument to make-condition, and is accessed by the function package-error-package.

See Also:

package-error-package, Chapter 9 (Conditions)

package-error-package

Expanded Reference: package-error

The package-error Condition Type

package-error is the condition type for errors related to package operations. It is a subtype of error.

(subtypep 'package-error 'error)
=> T
=> T

Creating a package-error Condition

You can create a package-error condition with make-condition, providing the :package initarg.

(let ((c (make-condition 'package-error
:package (find-package "COMMON-LISP"))))
(typep c 'package-error))
=> T

Catching package-error with handler-case

Package errors can be caught and handled programmatically.

(handler-case
(find-package (make-package "DUP-ERR-DEMO" :use '()))
;; make-package with a duplicate name may signal package-error
(package-error (c)
(format nil "Package error involving: ~A"
(package-error-package c))))

Class Precedence List

;; package-error inherits from error, serious-condition, condition, and t
(subtypep 'package-error 'serious-condition)
=> T
=> T

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