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

Show structured errors for graphql errors from the graphql function used in gatsby-node.js #15227

Merged
merged 3 commits into from
Jun 29, 2019

Conversation

KyleAMathews
Copy link
Contributor

Fixes #15212

Error before:
Screenshot 2019-06-28 15 20 05

Error after:
Screenshot 2019-06-28 15 20 36

Verified

This commit was signed with the committer’s verified signature.
hameerabbasi Hameer Abbasi
…sed in gatsby-node.js

Fixes #15212
@KyleAMathews KyleAMathews requested a review from a team as a code owner June 28, 2019 22:21
Copy link
Contributor

@m-allanson m-allanson left a comment

Choose a reason for hiding this comment

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

😍

There's a stray console in there, otherwise all 👍

packages/gatsby/src/bootstrap/index.js Outdated Show resolved Hide resolved

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Co-Authored-By: Mike Allanson <michael.allanson@gmail.com>
@KyleAMathews
Copy link
Contributor Author

Thinking about this a bit more, I think it'd make sense to use a different error code for graphql errors from the graphql function. It'll be helpful from a product standpoint to differentiate the two and also it might be useful to have different error messages.

@KyleAMathews
Copy link
Contributor Author

Also it should be possible to print out the query. Would need to go looking for the graphql function for printing the query with the error highlighted.

@KyleAMathews
Copy link
Contributor Author

Decided to keep the same id & just note in the context that the error came from a graphql function call.

We should print out the query — let's work on that for this and other graphql errors in a future PR.

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.

Catch graphql errors from the graphql function and pretty-print errors
2 participants