-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Better error message for MDX html
field in development
#17210
Comments
Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open! As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing! Thanks for being a part of the Gatsby community! 💪💜 |
I understand the motivation here but I'm not sure if returning back placeholder text like you've described is a good idea. This could be something a user could very easily miss during development. What do you think? However, I do think that we could display a more descriptive error in the console. |
This seems like something that would benefit from a structured error message, as related to #15019. |
Summary
Currently, if you query the
html
field of gatsby-plugin-mdx GraphQL nodes in development, you get the following errors in the console and the GraphQL output.and:
This can be confusing, whether you’re mistakenly using
html
in a web page (it should bebody
), or when you’re testing out in development a query for the RSS feed or some place where you mean to usebody
.The plugin should either throw a more explicit error, or instead return an obviously incorrect, but helpful value for
html
.Basic example
For example, the query:
could return:
This message is not a GraphQL error, which means you can still see the rest of any query you’re working on work. It also contains some HTML, so you can use dev mode to check any encoding or escaping/unescaping you need to do.
Motivation
This is a confusing error message both for people who tried
html
when they should have usedbody
(#16706) and for people who knew they wantedhtml
but were confused why the query they were testing errored out (#17175).The text was updated successfully, but these errors were encountered: