jhc-systems / sqlest

Write SQL in Scala
https://jhc-systems.github.io/sqlest/latest/api/
Apache License 2.0
30 stars 17 forks source link

Optionally return more detailed exception messages when SQL statements fail #87

Closed DavidGregory084 closed 6 years ago

DavidGregory084 commented 6 years ago

@p14n @kutchar I'm interested in your opinions on this one

codecov-io commented 6 years ago

Codecov Report

Merging #87 into master will increase coverage by 0.15%. The diff coverage is 56.25%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #87      +/-   ##
==========================================
+ Coverage   81.63%   81.78%   +0.15%     
==========================================
  Files          43       43              
  Lines        1127     1142      +15     
  Branches       98      107       +9     
==========================================
+ Hits          920      934      +14     
- Misses        207      208       +1
Impacted Files Coverage Δ
...lest/src/main/scala/sqlest/executor/Database.scala 68.87% <56.25%> (+2.69%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update ca7af9f...f40a58f. Read the comment docs.

kutchar commented 6 years ago

@DavidGregory084 I like it! The only comment would be that verboseExceptions should probably be called wrapExceptions since you're basically wrapping the exception in a SqlestException, no?

DavidGregory084 commented 6 years ago

Yep, that sounds reasonable to me 👍

kutchar commented 6 years ago

What would be even better if we added a sql exception translation layer, similar to Spring DAO instead of only returning SqlestExceptions

See: SQLErrorCodeSQLExceptionTranslator SQLExceptionSubclassTranslator SQLStateSQLExceptionTranslator

DavidGregory084 commented 6 years ago

I'm going to merge this as-is as I don't think I will have a chance to look at error code mappings any time soon, hope that's ok