java.jdbc

ex-info thrown inside with-db-transaction is not preserved

Details

  • Type: Enhancement Enhancement
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Environment:
    Clojure 1.7.0, java.jdbc 0.3.7 (same issue exists in 0.4.2 but my active environment uses 0.3.7)

Description

I have a with-db-transaction block surrounding several queries, where in case one of them fails I would like to attach some locally known metadata about the individual query using ex-info. Unfortunately the clojure.java.jdbc/db-transaction* macro uses clojure.java.jdbc/throw-non-rte to strip off all the layers of RuntimeException around a thrown SQLException. Since clojure.lang.ExceptionInfo is a RuntimeException, this means that my metadata does not survive to the outside of the with-db-transaction macro, unless I defeat the intent of JVM exception handling by passing the original SQLException somewhere other than the cause field of my wrapper exception.

  • Is this RuntimeException stripping behavior mentioned in the public facing documentation for clojure.java.jdbc?
  • Is it feasible from a design point of view to suppress this behavior, either on a switch, or for ExceptionInfo only, or both?

(I am happy to supply a patch myself if you judge this an appropriate enhancement.)

Activity

Sean Corfield made changes -
Field Original Value New Value
Status Open [ 1 ] In Progress [ 3 ]
Sean Corfield made changes -
Status In Progress [ 3 ] Resolved [ 5 ]
Resolution Completed [ 1 ]
Sean Corfield made changes -
Status Resolved [ 5 ] Closed [ 6 ]

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: