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

Add GraphQLParser errors to verbose output #2873

Merged
merged 3 commits into from
Nov 13, 2017

Conversation

daniel-simpson
Copy link
Contributor

Was having issues with a malformed graphql query due to the differences between allContentfulX and contentfulX mappings. Very difficult to track down until I added the following GraphQLParser exception. I've scoped this to only show if verbose output is turned on to ensure newbies have some reference while using graphql, without getting in anyone else's way.

@gatsbybot
Copy link
Collaborator

gatsbybot commented Nov 10, 2017

Deploy preview ready!

Built with commit 143a815

https://deploy-preview-2873--gatsbygram.netlify.com

@gatsbybot
Copy link
Collaborator

gatsbybot commented Nov 10, 2017

Deploy preview ready!

Built with commit 143a815

https://deploy-preview-2873--using-drupal.netlify.com

@jquense
Copy link
Contributor

jquense commented Nov 10, 2017

hey there, thanks for the PR. I don't think we need to guard against this for verbose or specific parser errors. It's really a bug that the error details are getting swallowed here. Ideally waht should happen is that if the specialized gql error parsing doesn't turn up anything (as in your case) the default reporter behavior should be used, e.g. report.error(msg, originalError). That would require some or of signalling from this graphqlError method that it didn't understand the the error so that it's callsite can adjust. Or maybe we need to rethink how these get called in the first place idk

@KyleAMathews
Copy link
Contributor

Yeah, I really dislike "verbose" modes generally speaking.

@daniel-simpson could you try changing the PR to do as @jquense suggests?

Daniel Simpson added 2 commits November 11, 2017 09:18
Was having issues with a malformed graphql query due to the differences between allContentfulX and contentfulX mappings.  Very difficult to track down until I added the following GraphQLParser exception.  I've scoped this to only show if verbose output is turned on to ensure newbies have some reference while using graphql, without getting in anyone else's way.
@daniel-simpson
Copy link
Contributor Author

No problem. I've just updated the PR to display the original error if the formatted graphql error is empty. Very new to the project so please let me know if you prefer different syntax to the one I've used.

@KyleAMathews KyleAMathews merged commit 23e0dc5 into gatsbyjs:master Nov 13, 2017
@KyleAMathews
Copy link
Contributor

Thanks!

@revolunet
Copy link

thanks ! this improve developer experience a lot :)

@daniel-simpson daniel-simpson deleted the GraphQLParser-errors branch November 15, 2017 21:52
@rudasn
Copy link

rudasn commented Nov 16, 2017

thanks 👍

@fk fk added DX labels Jan 19, 2018
@jlengstorf
Copy link
Contributor

Hiya @daniel-simpson! 👋

This is definitely late, but on behalf of the entire Gatsby community, I wanted to say thank you for being here.

Gatsby is built by awesome people like you. Let us say “thanks” in two ways:

  1. We’d like to send you some Gatsby swag. As a token of our appreciation, you can go to the Gatsby Swag Store and log in with your GitHub account to get a coupon code good for one free piece of swag. (We’ve got t-shirts and hats, plus some socks that are really razzing our berries right now.)
  2. If you’re not already part of it, we just invited you to join the Gatsby organization on GitHub. This will add you to our team of maintainers. You’ll receive an email shortly asking you to confirm. By joining the team, you’ll be able to label issues, review pull requests, and merge approved pull requests.

If you have questions, please don’t hesitate to reach out to us: tweet at @gatsbyjs and we’ll come a-runnin’.

Thanks again! 💪💜

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.

8 participants