-
Notifications
You must be signed in to change notification settings - Fork 259
Aggregate errors with @inaccessible #1563
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
Aggregate errors with @inaccessible #1563
Conversation
Previously, `removeInaccessibleElements` would throw an error the first time it encountered an inaccessible mismatch for types & fields. With this change, the code will continue to parse the schema and report an `AggregateError` that contains all the mismatches.
@benweatherman: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Apollo Contributor License Agreement here: https://contribute.apollographql.com/ |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
`ErrGraphQLValidationFailed` supports multiple errors and node12 & node14 don't support es2019 (which is when `AggregateError` was introduced). So rather than monkeying with node versions and polyfills, we'll just use what's already available.
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.
Really sorry to be late to the party. The change looks good overall, but it only account for the "remove inacessible stuffs" of toAPISchema
and there is other stuff that can fail in there. Since this kind of change the "API" to toAPISchema
, wonder if we should try to harmonize those part a bit. I think I'm mostly thinking of have a couple try/catch in toAPISchema
that unwraps causes, merge them, and may ensure we consistently throw an aggregate error (with a custom error message) so caller can always expect an aggregate.
✅ Deploy Preview for apollo-federation-docs ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
At first blush, I think it's OK to throw multiple types of errors from Barring that, I'd say these changes are ready to merge. |
Yeah, you're right, that's fine.
+1 |
Previously,
removeInaccessibleElements
would throw an error the first time it encountered an inaccessible mismatch for types & fields.With this change, the code will continue to parse the schema and report an
ErrGraphQLValidationFailed
that contains all the mismatches.