0.8.16.2: TYPE-ERROR for ERROR
[sbcl.git] / src / code / target-error.lisp
index 4c8eb83..288f3e1 100644 (file)
@@ -87,7 +87,7 @@
 (defun find-restart-or-control-error (identifier &optional condition)
   (or (find-restart identifier condition)
       (error 'simple-control-error
-            :format-control "No restart ~S is active ~{for ~S~}."
+            :format-control "No restart ~S is active~@[ for ~S~]."
             :format-arguments (list identifier condition))))
 
 (defun invoke-restart (restart &rest values)
   (list (eval (read *query-io*))))
 
 (defun check-type-error (place place-value type type-string)
-  (let ((cond (if type-string
-                 (make-condition 'simple-type-error
-                                 :datum place
-                                 :expected-type type
-                                 :format-control
-                                 "The value of ~S is ~S, which is not ~A."
-                                 :format-arguments (list place
-                                                         place-value
-                                                         type-string))
-                 (make-condition 'simple-type-error
-                                 :datum place
-                                 :expected-type type
-                                 :format-control
-                         "The value of ~S is ~S, which is not of type ~S."
-                                 :format-arguments (list place
-                                                         place-value
-                                                         type)))))
-    (restart-case (error cond)
+  (let ((condition
+        (make-condition
+         'simple-type-error
+         :datum place-value
+         :expected-type type
+         :format-control
+         "The value of ~S is ~S, which is not ~:[of type ~S~;~:*~A~]."
+         :format-arguments (list place place-value type-string type))))
+    (restart-case (error condition)
       (store-value (value)
        :report (lambda (stream)
                  (format stream "Supply a new value for ~S." place))