[clouchdb-cvs] CVS clouchdb/src

peddy peddy at common-lisp.net
Sat Dec 8 15:16:21 UTC 2007


Update of /project/clouchdb/cvsroot/clouchdb/src
In directory clnet:/tmp/cvs-serv31642/src

Modified Files:
	clouchdb.lisp 
Log Message:
Fixed/cleaned up db conditions


--- /project/clouchdb/cvsroot/clouchdb/src/clouchdb.lisp	2007/12/01 14:19:59	1.1.1.1
+++ /project/clouchdb/cvsroot/clouchdb/src/clouchdb.lisp	2007/12/08 15:16:21	1.2
@@ -42,15 +42,26 @@
 ;;
 
 (define-condition db-existential-error (error)
-  ((text :initarg :text :reader text)
+  ((text :initarg :uri :reader uri)
    (db-name :initarg :db-name :reader db-name)
    (result :initarg :result :reader result)))
 
-(define-condition db-does-not-exist (db-existential-error) ())
-(define-condition db-already-exists (db-existential-error) ())
+(define-condition db-does-not-exist (db-existential-error) 
+  ()
+  (:report (lambda (condition stream)
+	     (format stream "Database \"~A\" at \"~A\" does not exist" 
+		     (db-name condition)
+		     (uri condition)))))
+
+(define-condition db-already-exists (db-existential-error) 
+  ()
+  (:report (lambda (condition stream)
+	     (format stream "Database \"~A\" at \"~A\" already exists" 
+		     (db-name condition)
+		     (uri condition)))))
 
 (define-condition doc-error (error) 
-  ((text :initarg :text :reader text)
+  ((text :initarg :uri :reader text)
    (reason :initarg :reason :reader reason)
    (id :initarg :id :reader id)))
   
@@ -62,8 +73,7 @@
 
 (define-condition id-missing (doc-error)
   ()
-  (:report (lambda (condition stream)
-	     (format stream "No ID specified"))))
+  (:report (lambda (condition stream) (format stream "No ID specified"))))
 
 (define-condition document-missing (doc-error) 
   ()
@@ -132,9 +142,8 @@
 	 (let ((dbn (if ,db-name-p ,db-name *db-name*)))
 	   (if (document-property :error  (get-db-info :db-name dbn))
 	       (error 'db-does-not-exist
-		      :result ,result :dbn dbn
-		      :text (format t "Database ~S does not exist"
-				    (make-uri dbn))))))
+		      :result ,result :db-name dbn
+		      :uri (make-uri dbn)))))
        ,result)))
 
 ;;
@@ -247,8 +256,7 @@
 	 (restart-case
 	     (error 'db-already-exists
 		    :result res :db-name name
-		    :text (format t "Database ~S already exists"
-				  (make-uri name)))
+		    :uri (make-uri name))
 	   (ignore () :report "Ignore error and continue" nil))))
       res)))
 
@@ -263,8 +271,7 @@
 	(restart-case 
 	    (error 'db-does-not-exist
 		   :result res :db-name name
-		   :text (format t "Database ~S does not exist"
-				 (make-uri name)))
+		   :uri (make-uri name))
 	  (ignore () :report "Ignore error and continue" nil)))
     res))
 




More information about the clouchdb-cvs mailing list