-
Notifications
You must be signed in to change notification settings - Fork 132
#57 - Add support for R2DBC subclass exception translation. #97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
We now use R2DBC's exception hierarchy to translate exceptions into Spring's DataAccessException hierarchy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One inline comment.
Also I'm not sure the exception message looks as it should, especially when there is no error message.
See the added tests I added in a commit.
@Nullable | ||
protected DataAccessException doTranslate(String task, @Nullable String sql, R2dbcException ex) { | ||
|
||
if (ex instanceof R2dbcTransientException) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are these outer if
statements for?
Performance?
Is this worth it?
I find it rather confusing and given that exceptions should be the exception, saving up to two conditionals by paying 1-2 extra doesn't seem worth it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a branch organization aspect that maintains readability. Transient resources come in one block, non-transients in the other one. See also https://github.com/spring-projects/spring-framework/blob/master/spring-jdbc/src/main/java/org/springframework/jdbc/support/SQLExceptionSubclassTranslator.java.
Basically, all conventions originate in how Spring Framework translates exceptions and represents these. We should stick to the Spring JDBC way to remain consistent. |
We now use R2DBC's exception hierarchy to translate exceptions into Spring's DataAccessException hierarchy. Original pull request: #97.
Merged |
We now use R2DBC's exception hierarchy to translate exceptions into Spring's
DataAccessException
hierarchy.Related ticket: #57.