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

standardize error messages prior to introducing schema coordinates #4177

Merged
merged 5 commits into from
Sep 4, 2024

Conversation

yaacovCR
Copy link
Contributor

@yaacovCR yaacovCR commented Aug 23, 2024

extracted from #3808

PR #3808 uses schema coordinates to improve GraphQL-JS error messages. To reduce the size of the PR, this commit standardizes error messages according to the general pattern that will be introduced with schema coordinates without introducing the coordinates themselves, in the hopes of aiding review of the later PR.

EDITED 8/26/2024:

I was able to reproduce all of the standardized error messages from #3808 except for the ones in getArgumentValues when it is passed a Field Definition, because the parent type is not passed. Everything else can be calculated for the error messages we are currently printing, although schema coordinates simplifies things.

Extracting these changes out of #3808 and rebasing #3808 on main will therefore will better demonstrate how schema coordinates improves the clarity of some of our error messages (namely, getArgumentValues) and simplifies printing them.

@yaacovCR yaacovCR requested a review from a team as a code owner August 23, 2024 14:28
@yaacovCR yaacovCR added the PR: bug fix 🐞 requires increase of "patch" version number label Aug 23, 2024
Copy link

netlify bot commented Aug 23, 2024

Deploy Preview for compassionate-pike-271cb3 ready!

Name Link
🔨 Latest commit 8635c9c
🔍 Latest deploy log https://app.netlify.com/sites/compassionate-pike-271cb3/deploys/66cc6f503fa8d500085f7d2e
😎 Deploy Preview https://deploy-preview-4177--compassionate-pike-271cb3.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 configuration.

Copy link

Hi @yaacovCR, I'm @github-actions bot happy to help you with this PR 👋

Supported commands

Please post this commands in separate comments and only one per comment:

  • @github-actions run-benchmark - Run benchmark comparing base and merge commits for this PR
  • @github-actions publish-pr-on-npm - Build package from this PR and publish it on NPM

extracted from graphql#3808

PR graphql#3808 uses schema coordinates to improve GraphQL-JS error messages. To reduce the size of the PR, this commit standardizes error messages according to the general pattern that will be introduced with schema coordinates without introducing the coordinates themselves, in the hopes of aiding review of the later PR.

Parenthetically, extracting these changes out of graphql#3808 demonstrates how the use of schema coordinates improves our error messages. For example, it is difficult when printing an error message regarding an argument to easily look up the field of that argument, and, if it a nested input field, the full field path. It is similarly sometimes difficult to know the type of the field or argument triggering the error. Embedding schema coordinates within GraphQL-JS makes this trivial. This PR simply omits the changes from graphql#3808 that are directly enabled by the use of schema coordinates. graphql#3808 can then be rebased on top of this PR to demonstrate the code changes and the direct improvement in the various error messages.
@yaacovCR yaacovCR force-pushed the standardize-errors branch from fcecd91 to e184259 Compare August 23, 2024 14:31
@yaacovCR

This comment was marked as outdated.

@yaacovCR yaacovCR force-pushed the standardize-errors branch from 604bd20 to ccd814a Compare August 25, 2024 19:33
@yaacovCR
Copy link
Contributor Author

yaacovCR commented Aug 26, 2024

Actually, I was able to minimize the diff everywhere except for the errors in getArgumentValues when it is passed a Field Definition, because the parent type is not passed. Everything else can be calculated for the error messages we are currently printing, although schema coordinates simplifies things. Edited above description to that effect.

@yaacovCR yaacovCR merged commit 426b017 into graphql:main Sep 4, 2024
20 checks passed
@yaacovCR yaacovCR deleted the standardize-errors branch September 4, 2024 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: bug fix 🐞 requires increase of "patch" version number
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants