Skip to content
Snippets Groups Projects
Commit 0868a296 authored by wlott's avatar wlott
Browse files

Added a :report for type-errors and spiffed up the report for

unbound-variable and undefined-function.
parent 55dde220
No related branches found
No related tags found
No related merge requests found
...@@ -727,7 +727,13 @@ The previous version is uglier, but it sets up unique run-time tags. ...@@ -727,7 +727,13 @@ The previous version is uglier, but it sets up unique run-time tags.
(define-condition type-error (error) (define-condition type-error (error)
(datum (datum
expected-type)) expected-type)
(:report
(lambda (condition stream)
(format stream "Type-error in ~S:~% ~S is not of type ~S"
(type-error-function-name condition)
(type-error-datum condition)
(type-error-expected-type condition)))))
;;; The simple-type-error type has a conc-name, so ;;; The simple-type-error type has a conc-name, so
;;; SIMPLE-CONDITION-FORMAT-STRING and SIMPLE-CONDITION-FORMAT-ARGUMENTS could ;;; SIMPLE-CONDITION-FORMAT-STRING and SIMPLE-CONDITION-FORMAT-ARGUMENTS could
...@@ -798,14 +804,20 @@ The previous version is uglier, but it sets up unique run-time tags. ...@@ -798,14 +804,20 @@ The previous version is uglier, but it sets up unique run-time tags.
(define-condition cell-error (error) (name)) (define-condition cell-error (error) (name))
(define-condition unbound-variable (cell-error) () (define-condition unbound-variable (cell-error) ()
(:report (lambda (condition stream) (:report
(format stream "The variable ~S is unbound." (lambda (condition stream)
(cell-error-name condition))))) (format stream
"Error in ~S: the variable ~S is unbound."
(cell-error-function-name condition)
(cell-error-name condition)))))
(define-condition undefined-function (cell-error) () (define-condition undefined-function (cell-error) ()
(:report (lambda (condition stream) (:report
(format stream "The function ~S is undefined." (lambda (condition stream)
(cell-error-name condition))))) (format stream
"Error in ~S: the function ~S is undefined."
(cell-error-function-name condition)
(cell-error-name condition)))))
(define-condition arithmetic-error (error) (operation operands) (define-condition arithmetic-error (error) (operation operands)
(:report (lambda (condition stream) (:report (lambda (condition stream)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment