X-Git-Url: http://git.kpe.io/?p=clsql.git;a=blobdiff_plain;f=sql%2Fconditions.lisp;h=72c4d31d1a98eb4a873c23c4b3f6db78c874bf79;hp=dc48d2fc1201a1da10ad512041b0515621aa2975;hb=749215ad8b022f7e2d533f5f82097d2d131eefd6;hpb=bb245c9d1616927d1302f3f36d3ebbf6a0dd662d diff --git a/sql/conditions.lisp b/sql/conditions.lisp index dc48d2f..72c4d31 100644 --- a/sql/conditions.lisp +++ b/sql/conditions.lisp @@ -58,9 +58,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 +113,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) @@ -122,9 +126,9 @@ connection is no longer usable.")) ;;; CLSQL Extensions (define-condition sql-warning (warning sql-condition) - ((message :initarg :message :reader sql-warning-message)) + ((message :initarg :message :initform nil :reader sql-warning-message)) (:report (lambda (c stream) - (format stream (sql-warning-message c))))) + (format stream "~A" (sql-warning-message c))))) (define-condition sql-database-warning (sql-warning) ((database :initarg :database :reader sql-warning-database))