[movitz-cvs] CVS movitz/losp/muerte

ffjeld ffjeld at common-lisp.net
Wed Apr 9 18:01:37 UTC 2008


Update of /project/movitz/cvsroot/movitz/losp/muerte
In directory clnet:/tmp/cvs-serv7715

Modified Files:
	conditions.lisp 
Log Message:
Somewhat improved ecase (signal a type-error).


--- /project/movitz/cvsroot/movitz/losp/muerte/conditions.lisp	2008/04/08 21:42:08	1.25
+++ /project/movitz/cvsroot/movitz/losp/muerte/conditions.lisp	2008/04/09 18:01:36	1.26
@@ -10,7 +10,7 @@
 ;;;; Author:        Frode Vatvedt Fjeld <frodef at acm.org>
 ;;;; Created at:    Wed Nov 20 15:47:04 2002
 ;;;;                
-;;;; $Id: conditions.lisp,v 1.25 2008/04/08 21:42:08 ffjeld Exp $
+;;;; $Id: conditions.lisp,v 1.26 2008/04/09 18:01:36 ffjeld Exp $
 ;;;;                
 ;;;;------------------------------------------------------------------
 
@@ -127,6 +127,18 @@
 	 :datum datum
 	 :expected-type (cons 'or expecteds)))
 
+(define-condition ecase-error (type-error)
+  ()
+  (:report (lambda (c s)
+	     (format s "The object '~S' fell through an ecase where the legal cases were ~S."
+		     (type-error-datum c)
+		     (type-error-expected-type c)))))
+
+(defun ecase-error (datum expecteds)
+  (error 'ecase-error
+	 :datum datum
+	 :expected-type (cons 'member expecteds)))
+
 (define-condition control-error (error) ())
 
 (define-condition throw-error (control-error)




More information about the Movitz-cvs mailing list