Skip to content

Provide details when schema resource is invalid #307

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

dugenkui03
Copy link
Contributor

@dugenkui03 dugenkui03 commented Feb 23, 2022

Details about this PR in #304

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Feb 23, 2022

private final String resourceDescription;

private final SchemaProblem schemaProblem;
Copy link
Contributor Author

@dugenkui03 dugenkui03 Feb 24, 2022

Choose a reason for hiding this comment

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

The SchemaProblem will be changed from internal to publicApi, we are free to use it, details in issues 2734;

@@ -193,6 +194,9 @@ private TypeDefinitionRegistry parseSchemaResource(Resource schemaResource) {
catch (IOException ex) {
throw new IllegalArgumentException("Failed to load schema resource: " + schemaResource);
}
catch (SchemaProblem ex) {
throw new InvalidSchemaResourceException(schemaResource.getDescription(), ex);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The reason to create InvalidSchemaResourceException is that I think the 'wrong schema config' not match the semantic of IllegalArgumentException.

@bclozel bclozel self-assigned this Feb 28, 2022
@bclozel bclozel closed this in bc7500f Mar 3, 2022
@bclozel bclozel added type: enhancement A general enhancement in: core Issues related to config and core support and removed status: waiting-for-triage An issue we've not yet triaged labels Mar 3, 2022
@bclozel bclozel added this to the 1.0.0-M6 milestone Mar 3, 2022
@bclozel
Copy link
Member

bclozel commented Mar 3, 2022

Thanks for your contribution! I've simplified a bit things here since we don't need to rely on a particular graphql-java exception.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues related to config and core support type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants