;;;; stuff originally from CMU CL's error.lisp which can or should
;;;; come late (mostly related to the CONDITION class itself)
;;;;
-;;;; FIXME: should perhaps be called condition.lisp, or moved into
-;;;; classes.lisp
;;;; This software is part of the SBCL system. See the README file for
;;;; more information.
(t
(error "unknown option: ~S" (first option)))))
- (when (all-writers)
- (warn "Condition slot setters probably not allowed in ANSI CL:~% ~S"
- (all-writers)))
-
`(progn
(eval-when (:compile-toplevel :load-toplevel :execute)
(%compiler-define-condition ',name ',parent-types ',layout))
((pathname :reader file-error-pathname :initarg :pathname))
(:report
(lambda (condition stream)
- (format stream
- "~@<error on file ~_~S: ~2I~:_~?~:>"
- (file-error-pathname condition)
- ;; FIXME: ANSI's FILE-ERROR doesn't have FORMAT-CONTROL and
- ;; FORMAT-ARGUMENTS, and the inheritance here doesn't seem
- ;; to give us FORMAT-CONTROL or FORMAT-ARGUMENTS either.
- ;; So how does this work?
- (serious-condition-format-control condition)
- (serious-condition-format-arguments condition)))))
+ (format stream "error on file ~S" (file-error-pathname condition)))))
(define-condition package-error (error)
((package :reader package-error-package :initarg :package)))
"The function ~S is undefined."
(cell-error-name condition)))))
+(define-condition special-form-function (undefined-function) ()
+ (:report
+ (lambda (condition stream)
+ (format stream
+ "Cannot FUNCALL the SYMBOL-FUNCTION of special operator ~S."
+ (cell-error-name condition)))))
+
(define-condition arithmetic-error (error)
((operation :reader arithmetic-error-operation
:initarg :operation
"The index ~S is too large."
(type-error-datum condition)))))
+(define-condition bounding-indices-bad-error (type-error)
+ ((object :reader bounding-indices-bad-object :initarg :object))
+ (:report
+ (lambda (condition stream)
+ (let* ((datum (type-error-datum condition))
+ (start (car datum))
+ (end (cdr datum))
+ (object (bounding-indices-bad-object condition)))
+ (etypecase object
+ (sequence
+ (format stream
+ "The bounding indices ~S and ~S are bad for a sequence of length ~S."
+ start end (length object)))
+ (array
+ ;; from WITH-ARRAY-DATA
+ (format stream
+ "The START and END parameters ~S and ~S are bad for an array of total size ~S."
+ start end (array-total-size object))))))))
+
+(define-condition nil-array-accessed-error (type-error)
+ ()
+ (:report (lambda (condition stream)
+ (format stream
+ "An attempt to access an array of element-type ~
+ NIL was made. Congratulations!"))))
+
(define-condition io-timeout (stream-error)
((direction :reader io-timeout-direction :initarg :direction))
(:report
"unexpected end of file on ~S ~A"
(stream-error-stream condition)
(reader-eof-error-context condition)))))
+
+(define-condition reader-impossible-number-error (reader-error)
+ ((error :reader reader-impossible-number-error-error :initarg :error))
+ (:report
+ (lambda (condition stream)
+ (let ((error-stream (stream-error-stream condition)))
+ (format stream "READER-ERROR ~@[at ~W ~]on ~S:~%~?~%Original error: ~A"
+ (file-position error-stream) error-stream
+ (reader-error-format-control condition)
+ (reader-error-format-arguments condition)
+ (reader-impossible-number-error-error condition))))))
\f
;;;; special SBCL extension conditions
alien code or from unsafe Lisp code; or there might be a bug ~
in the OS or hardware that SBCL is running on.) If it seems to ~
be a bug in SBCL itself, the maintainers would like to know ~
- how to exercise the bug so it can be fixed. Bug reports are ~
- welcome on the SBCL mailing lists, which you can find at ~
+ about it. Bug reports are welcome on the SBCL ~
+ mailing lists, which you can find at ~
<http://sbcl.sourceforge.net/>.~:@>"
'((fmakunbound 'compile))))))
(defun bug (format-control &rest format-arguments)