yogthos / migratus

MIGRATE ALL THE THINGS!
644 stars 95 forks source link

Re-throw connection error #236

Closed zhming0 closed 1 year ago

zhming0 commented 1 year ago

Background

Currently when there is connection issue, the connection exception will be captured and logged. And usually that will incur another exception:

java.lang.NullPointerException: Cannot invoke "java.sql.Connection.setAutoCommit(boolean)" because "conn" is null

which is less useful than the original exception.

Although the exception is logged by Migratus through slf4j, these days there are devs who does not (or cannot) provide slf4j backend for various reasons.

This PR

Re-throw exceptions so library user can properly & freely handle it.

yogthos commented 1 year ago

Thanks, the change makes sense. I just released 1.4.8 to Clojars with the fix.