(module exceptions mzscheme
(require "p3-msg.ss")
(provide (struct exn:spgsql:backend ())
raise-backend-error)
(define-struct (exn:spgsql:backend exn:fail:user) (properties))
(define (raise-backend-error function r)
(define code (cdr (assq 'code (ErrorResponse-properties r))))
(define message (cdr (assq 'message (ErrorResponse-properties r))))
(raise
(make-exn:spgsql:backend
(string-append (if function
(string-append (symbol->string function) ": ")
"")
message
" (SQL code " code ")")
(current-continuation-marks)
(ErrorResponse-properties r))))
)