mirror of
https://github.com/dimitri/pgloader.git
synced 2025-08-10 00:07:00 +02:00
Some more error handling.
This commit is contained in:
parent
4095b74db7
commit
a9d160dc32
@ -72,7 +72,9 @@
|
||||
((condition
|
||||
#'(lambda (c)
|
||||
(if debug
|
||||
(trivial-backtrace:print-backtrace c :verbose t)
|
||||
(trivial-backtrace:print-backtrace c
|
||||
:output *standard-output*
|
||||
:verbose t)
|
||||
(trivial-backtrace:print-condition c *standard-output*)))))
|
||||
(let ((min-messages (cond (debug :debug)
|
||||
(verbose :info)
|
||||
|
@ -52,16 +52,20 @@
|
||||
(declare (ignore res))
|
||||
(pgstate-incf state label :rows count :secs secs)))
|
||||
|
||||
;;;
|
||||
;;; PostgreSQL queries
|
||||
;;;
|
||||
(defun pgsql-execute (sql &key ((:client-min-messages level)))
|
||||
"Execute given SQL in current transaction"
|
||||
(when level
|
||||
(pomo:execute
|
||||
(format nil "SET LOCAL client_min_messages TO ~a;" (symbol-name level))))
|
||||
|
||||
(pomo:execute sql)
|
||||
(handler-case
|
||||
;; execute the query, catching errors and warnings
|
||||
(pgsql-execute sql)
|
||||
|
||||
(cl-postgres:database-error (e)
|
||||
(log-message :error "~a" e))
|
||||
(cl-postgres:postgresql-warning (w)
|
||||
(log-message :warning "~a" w)))
|
||||
|
||||
(when level (pomo:execute (format nil "RESET client_min_messages;"))))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user