mirror of
https://github.com/dimitri/pgloader.git
synced 2026-01-24 16:41:03 +01:00
Add support for the newer Qmynd error handling.
We now have a qmynd-impl::decoding-error condition to deal with, which as a very good error reporting, so that we don't need to poke into babel details anymore. The error message adds the column name, type and collation to the output, too. We keep the babel handlers for a while until people have all migrated to using the patch in qmynd. With the fix to Qmynd, Fix #716.
This commit is contained in:
parent
572f6a3dbe
commit
ba2d8669c3
@ -88,12 +88,21 @@
|
||||
|
||||
(defun call-with-encoding-handler (copy-mysql table-name func)
|
||||
(handler-bind
|
||||
;; avoid trying to fetch the character at end-of-input position...
|
||||
((babel-encodings:end-of-input-in-character
|
||||
;; Newer versions of qmynd handle the babel error and signal this one
|
||||
;; with more details and an improved reporting:
|
||||
((qmynd-impl::decoding-error
|
||||
#'(lambda (c)
|
||||
(update-stats :data (target copy-mysql) :errs 1)
|
||||
(log-message :error "~a" c)
|
||||
(invoke-restart 'qmynd-impl::use-nil)))
|
||||
|
||||
;; Older versions of qmynd reported babel errors directly
|
||||
(babel-encodings:end-of-input-in-character
|
||||
#'(lambda (c)
|
||||
(update-stats :data (target copy-mysql) :errs 1)
|
||||
(log-message :error "~a" c)
|
||||
(invoke-restart 'qmynd-impl::use-nil)))
|
||||
|
||||
(babel-encodings:character-decoding-error
|
||||
#'(lambda (c)
|
||||
(update-stats :data (target copy-mysql) :errs 1)
|
||||
@ -104,7 +113,8 @@
|
||||
(when (and position (< position (length buffer)))
|
||||
(aref buffer position))))
|
||||
(log-message :error
|
||||
"~a: Illegal ~a character starting at position ~a~@[: ~a~]."
|
||||
"While decoding text data from MySQL table ~s: ~%~
|
||||
Illegal ~a character starting at position ~a~@[: ~a~].~%"
|
||||
table-name encoding position character))
|
||||
(invoke-restart 'qmynd-impl::use-nil))))
|
||||
(funcall func)))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user