Skip to content
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

Refine exception translation for client session exceptions #605

Closed
wants to merge 5 commits into from

Conversation

christophstrobl
Copy link
Member

@christophstrobl christophstrobl commented Aug 28, 2018

We now distinguish between Transient and NonTransient failures by checking the Error labels of an Error and create the according DataAccessException based on that information.

mp911de and others added 3 commits August 30, 2024 11:11
…tions.

We now distinguish between Transient and NonTransient failures by checking the Error labels of an Error and create the according DataAccessException based on that information.

These URLs were switched to an https URL with a 2xx status. While the status was successful, your review is still recommended.

* [ ] http://www.apache.org/licenses/ with 1 occurrences migrated to:
  https://www.apache.org/licenses/ ([https](https://www.apache.org/licenses/) result 200).
* [ ] http://www.apache.org/licenses/LICENSE-2.0 with 852 occurrences migrated to:
  https://www.apache.org/licenses/LICENSE-2.0 ([https](https://www.apache.org/licenses/LICENSE-2.0) result 200).

Original Pull Request: #721
@mp911de mp911de added type: bug A general bug for: team-attention An issue we need to discuss as a team to make progress labels Aug 30, 2024
@mp911de mp911de changed the base branch from 3.4.x to main August 30, 2024 09:20
@mp911de
Copy link
Member

mp911de commented Aug 30, 2024

Spring's DAO exceptions do not differentiate between contextual transience in the sense that MongoDB does. Re-wrapping exceptions to add another transient flavour isn't appropriate. We also do not have a way to add this flavor to exceptions that we use such as DataAccessResourceFailureException. It's always possible to introspect the original MongoDB exception labels, especially that we now provide MongoExceptionTranslator.isTransientFailure.

I updated the PR to allow the configuration of a MongoExceptionTranslator so that applications can tailor exception translation to their requirements.

@mp911de mp911de removed the for: team-attention An issue we need to discuss as a team to make progress label Sep 3, 2024
if (MongoDbErrorCodes.isDataIntegrityViolationError(mongoException)) {
return new DataIntegrityViolationException(mongoException.getMessage(), mongoException);
}
if (MongoDbErrorCodes.isClientSessionFailure(mongoException)) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as in line 143?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the DataIntegrityViolation block is duplicated as well, seems a remainder from conflict resolution. Both if branches can go away.

@mp911de mp911de changed the title DATAMONGO-2073 - Evaluate exception label when translating MongoException. Refine exception translation for client session exceptions Sep 4, 2024
@mp911de mp911de added this to the 4.4 M1 (2024.1.0) milestone Sep 4, 2024
mp911de added a commit that referenced this pull request Sep 4, 2024
Original pull request: #605
See #3148
See #2939
@mp911de mp911de closed this Sep 4, 2024
@mp911de mp911de deleted the issue/DATAMONGO-2073 branch September 4, 2024 06:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MongoExceptionTranslator hides WriteConflicts [DATAMONGO-2291]
2 participants