Initial revision
[sbcl.git] / src / code / error.lisp
1 ;;;; SBCL-specific parts of the condition system, i.e. parts which
2 ;;;; don't duplicate/clobber functionality already provided by the
3 ;;;; cross-compilation host Common Lisp
4
5 ;;;; This software is part of the SBCL system. See the README file for
6 ;;;; more information.
7 ;;;;
8 ;;;; This software is derived from the CMU CL system, which was
9 ;;;; written at Carnegie Mellon University and released into the
10 ;;;; public domain. The software is in the public domain and is
11 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
12 ;;;; files for more information.
13
14 (in-package "SB!CONDITIONS")
15
16 (sb!int:file-comment
17   "$Header$")
18
19 (define-condition simple-style-warning (simple-condition style-warning) ())
20
21 ;;; not sure this is the right place, but where else?
22 (defun style-warn (format-control &rest format-arguments)
23   (warn 'simple-style-warning
24         :format-control format-control
25         :format-arguments format-arguments))
26
27 (define-condition simple-type-error (simple-condition type-error) ())
28
29 (define-condition sb!kernel:layout-invalid (type-error)
30   ()
31   (:report
32    (lambda (condition stream)
33      (format stream "Layout-invalid error in ~S:~@
34                      Type test of class ~S was passed obsolete instance:~%  ~S"
35              (condition-function-name condition)
36              (sb!kernel:class-proper-name (type-error-expected-type condition))
37              (type-error-datum condition)))))
38
39 (define-condition case-failure (type-error)
40   ((name :reader case-failure-name :initarg :name)
41    (possibilities :reader case-failure-possibilities :initarg :possibilities))
42   (:report
43     (lambda (condition stream)
44       (format stream "~@<~S fell through ~S expression. ~:_Wanted one of ~:S.~:>"
45               (type-error-datum condition)
46               (case-failure-name condition)
47               (case-failure-possibilities condition)))))
48
49 (define-condition simple-file-error    (simple-condition file-error)())
50 (define-condition simple-program-error (simple-condition program-error)())
51 (define-condition simple-control-error (simple-condition control-error)())
52
53 ;;; This condition is signalled whenever we make a UNKNOWN-TYPE so that
54 ;;; compiler warnings can be emitted as appropriate.
55 (define-condition parse-unknown-type (condition)
56   ((specifier :reader parse-unknown-type-specifier :initarg :specifier)))
57