Skip to content

#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

Closed
wants to merge 3 commits into from

Conversation

mp911de
Copy link
Member

@mp911de mp911de commented Apr 18, 2019

We now use R2DBC's exception hierarchy to translate exceptions into Spring's DataAccessException hierarchy.


Related ticket: #57.

mp911de added 2 commits April 18, 2019 16:09
We now use R2DBC's exception hierarchy to translate exceptions into Spring's DataAccessException hierarchy.
Copy link
Contributor

@schauder schauder left a 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) {
Copy link
Contributor

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.

Copy link
Member Author

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.

@mp911de
Copy link
Member Author

mp911de commented Apr 23, 2019

Basically, all conventions originate in how Spring Framework translates exceptions and represents these. We should stick to the Spring JDBC way to remain consistent.

schauder pushed a commit that referenced this pull request Apr 24, 2019
We now use R2DBC's exception hierarchy to translate exceptions into Spring's DataAccessException hierarchy.

Original pull request: #97.
schauder added a commit that referenced this pull request Apr 24, 2019
@schauder
Copy link
Contributor

Merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants