r9198: more needed tests
[clsql.git] / base / conditions.lisp
index f6f7e7f0364c165a926b229adf629529ba9e5a07..81a1226bfe48b02a2fbf1456f4bf3ed210303726 100644 (file)
 (define-condition clsql-simple-warning (simple-condition clsql-warning)
   ())
 
+(define-condition clsql-generic-error (clsql-error)
+  ((message :initarg :message
+           :reader clsql-generic-error-message))
+  (:report (lambda (c stream)
+            (format stream (clsql-generic-error-message c)))))
+
 (define-condition clsql-invalid-spec-error (clsql-error)
   ((connection-spec :initarg :connection-spec
                    :reader clsql-invalid-spec-error-connection-spec)
@@ -151,6 +157,16 @@ and signal an clsql-invalid-spec-error if they don't match."
             (format stream "~S is not a CLSQL database." 
                     (clsql-no-database-error-database c)))))
 
+(define-condition clsql-odbc-error (clsql-error)
+  ((odbc-message :initarg :odbc-message
+                :reader clsql-odbc-error-message)
+   (sql-state :initarg :sql-state :initform nil
+             :reader clsql-odbc-error-sql-state))
+  (:report (lambda (c stream)
+            (format stream "[ODBC error] ~A; state: ~A"
+                    (clsql-odbc-error-message c)
+                    (clsql-odbc-error-sql-state c)))))
+
 ;; Signal conditions