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

Aggregate errors with @inaccessible #1563

Merged
merged 11 commits into from
Mar 29, 2022

Conversation

benweatherman
Copy link
Contributor

@benweatherman benweatherman commented Mar 3, 2022

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.

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.
@apollo-cla
Copy link

@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/

@codesandbox-ci
Copy link

codesandbox-ci bot commented Mar 3, 2022

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.
Copy link
Contributor

@pcmanus pcmanus left a 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.

internals-js/src/inaccessibleSpec.ts Outdated Show resolved Hide resolved
@netlify
Copy link

netlify bot commented Mar 24, 2022

Deploy Preview for apollo-federation-docs ready!

Name Link
🔨 Latest commit 711baef
🔍 Latest deploy log https://app.netlify.com/sites/apollo-federation-docs/deploys/62422068a4ea2b00091f4ced
😎 Deploy Preview https://deploy-preview-1563--apollo-federation-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

internals-js/src/inaccessibleSpec.ts Outdated Show resolved Hide resolved
@benweatherman
Copy link
Contributor Author

wonder if we should try to harmonize those part a bit

At first blush, I think it's OK to throw multiple types of errors from toAPISchema. Sometimes they'll be an aggregated error, sometimes they'll be something else. But happy to talk through this more, I'm sure there's a lot there I'm not thinking about.

Barring that, I'd say these changes are ready to merge.

@pcmanus
Copy link
Contributor

pcmanus commented Mar 29, 2022

At first blush, I think it's OK to throw multiple types of errors from toAPISchema

Yeah, you're right, that's fine.

I'd say these changes are ready to merge.

+1

@benweatherman benweatherman merged commit 51dcda5 into main Mar 29, 2022
@benweatherman benweatherman deleted the weatherman/aggregate-invalid-inaccessible branch March 29, 2022 16:10
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.

3 participants