Skip to content

Improve error message if store module doesn't support a well-known fragment interface #2342

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 2 commits into from

Conversation

mp911de
Copy link
Member

@mp911de mp911de commented Mar 25, 2021

We now throw a RepositoryCreationException (or subclass) when a repository cannot be created due to a missing fragment, a fragment without implementation or if a well-known fragment is not supported by the repository factory.

Closes #2341

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Mar 25, 2021
@odrotbohm
Copy link
Member

odrotbohm commented Mar 25, 2021

What's the exact difference between FragmentNotImplementedException and MissingFragmentException? Superficially they sound very similar and I don't quite get the difference from the Javadoc. Probably not a big of a deal because the primary goal is to provide better error messages but in case someone would want to actually catch one or the other the question of which of the two to be caught arises.

@mp911de
Copy link
Member Author

mp911de commented Mar 25, 2021

MissingFragmentException is used when we identify custom methods and do not find an implementation for the method to be called. MFE isn't tied to a particular fragment, it's expressing that the composition doesn't contain what we're looking for. FragmentNotImplementedException signals that we identified a fragment but it has no implementation attached. FragmentNotImplementedException can only happen when configuring RepositoryComposition manually and it should not occur when bootstrapping repositories using repository scanning.

@odrotbohm
Copy link
Member

Does IncompleteFragmentException describe the situation better than MissingFragmentException then? A fragment is the entire interface, right, not just an individual method within it?

@mp911de
Copy link
Member Author

mp911de commented Mar 26, 2021

A fragment is an entire interface. I think IncompleteRepositoryCompositionException puts it better because we're in the context of a RepositoryComposition and we can't tell in that case which fragment is affected.

@odrotbohm
Copy link
Member

Any reason for the move to RepositoryException and drop the Creation? That sounds rather generic. Isn't all that structural validation tied to the repository creation?

@mp911de
Copy link
Member Author

mp911de commented Mar 26, 2021

Most exceptions happen indeed during repository creation. Some can happen when calling a repository method for a composition that wasn't configured properly. I'm not sure we can catch all failures early on. If we roll back runtime (invocation checks) for missing fragments/fragment implementations during repository method invocation, we could retain the concept of a creation exception.

@odrotbohm
Copy link
Member

How about RepositorySetupException? That slightly nudges into the direction of the arrangement of the repository.

…agment interface.

We now throw a RepositoryCreationException (or subclass) when a repository cannot be created due to a missing fragment, a fragment without implementation or if a well-known fragment is not supported by the repository factory.

Throw QueryCreationException if QueryExecutorMethodInterceptor cannot resolve a RepositoryQuery.

Closes #2341
mp911de added a commit that referenced this pull request Mar 29, 2021
…agment interface.

We now throw a RepositoryCreationException (or subclass) when a repository cannot be created due to a missing fragment, a fragment without implementation or if a well-known fragment is not supported by the repository factory.

Throw QueryCreationException if QueryExecutorMethodInterceptor cannot resolve a RepositoryQuery.

Closes #2341
Original pull request: #2342.
@mp911de
Copy link
Member Author

mp911de commented Mar 29, 2021

That's merged now.

@mp911de mp911de closed this Mar 29, 2021
@mp911de mp911de deleted the issue/2341 branch March 29, 2021 08:23
mp911de added a commit that referenced this pull request Mar 29, 2021
…agment interface.

We now throw a RepositoryCreationException (or subclass) when a repository cannot be created due to a missing fragment, a fragment without implementation or if a well-known fragment is not supported by the repository factory.

Throw QueryCreationException if QueryExecutorMethodInterceptor cannot resolve a RepositoryQuery.

Closes #2341
Original pull request: #2342.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve error messages if a repository cannot be created
3 participants