cd7a39d8d586409f07642c586c43111000861596
[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!KERNEL")
15
16 (define-condition simple-style-warning (simple-condition style-warning) ())
17
18 ;;; not sure this is the right place, but where else?
19 (defun style-warn (format-control &rest format-arguments)
20   (warn 'simple-style-warning
21         :format-control format-control
22         :format-arguments format-arguments))
23
24 (define-condition sb!kernel:layout-invalid (type-error)
25   ()
26   (:report
27    (lambda (condition stream)
28      (format stream
29              "~@<invalid structure layout: ~
30               ~2I~_A test for class ~4I~_~S ~
31               ~2I~_was passed the obsolete instance ~4I~_~S~:>"
32              (sb!kernel:class-proper-name (type-error-expected-type condition))
33              (type-error-datum condition)))))
34
35 (define-condition case-failure (type-error)
36   ((name :reader case-failure-name :initarg :name)
37    (possibilities :reader case-failure-possibilities :initarg :possibilities))
38   (:report
39     (lambda (condition stream)
40       (format stream "~@<~S fell through ~S expression. ~
41                       ~:_Wanted one of ~:S.~:>"
42               (type-error-datum condition)
43               (case-failure-name condition)
44               (case-failure-possibilities condition)))))
45
46 (define-condition simple-control-error (simple-condition control-error) ())
47 (define-condition simple-file-error    (simple-condition file-error)    ())
48 (define-condition simple-program-error (simple-condition program-error) ())
49 (define-condition simple-stream-error  (simple-condition stream-error)  ())
50
51 ;;; This condition is signalled whenever we make a UNKNOWN-TYPE so that
52 ;;; compiler warnings can be emitted as appropriate.
53 (define-condition parse-unknown-type (condition)
54   ((specifier :reader parse-unknown-type-specifier :initarg :specifier)))
55