X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=sql%2Fconditions.lisp;h=bd36b8c0ddefdf068fb125d1fa2133538682c603;hb=d0b5c8c2a14929792d2d5818b57db27cae4484b2;hp=4e3380f7e276d655a460d4af995d08029c492834;hpb=cc7abc6063ff8a803064c75c400ec7d31fd29a21;p=clsql.git diff --git a/sql/conditions.lisp b/sql/conditions.lisp index 4e3380f..bd36b8c 100644 --- a/sql/conditions.lisp +++ b/sql/conditions.lisp @@ -17,15 +17,16 @@ (in-package #:clsql-sys) (defvar *backend-warning-behavior* :warn - "Action to perform on warning messages from backend. Default is to :warn. May also be -set to :error to signal an error or :ignore/nil to silently ignore the warning.") + "Action to perform on warning messages from backend. Default is +to :warn. May also be set to :error to signal an error +or :ignore/nil to silently ignore the warning.") ;;; CommonSQL-compatible conditions (define-condition sql-condition () ()) -(define-condition sql-error (simple-error) +(define-condition sql-error (simple-error sql-condition) ()) (define-condition sql-database-error (sql-error) @@ -58,9 +59,11 @@ set to :error to signal an error or :ignore/nil to silently ignore the warning." :reader sql-error-connection-spec)) (:report (lambda (c stream) (format stream "While trying to connect to database ~A~% using database-type ~A:~% Error ~D / ~A~% has occurred." - (database-name-from-spec - (sql-error-connection-spec c) - (sql-error-database-type c)) + (when (and (sql-error-connection-spec c) + (sql-error-database-type c)) + (database-name-from-spec + (sql-error-connection-spec c) + (sql-error-database-type c))) (sql-error-database-type c) (sql-error-error-id c) (sql-error-database-message c)))) @@ -111,6 +114,8 @@ connection is no longer usable.")) (defun signal-closed-database-error (database) (error 'sql-fatal-error :database database + :connection-spec (when database (connection-spec database)) + :database-type (when database (database-type database)) :message "Database is closed.")) (defun signal-no-database-error (database)