-
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
Add more context to error reporting #8524
Comments
If anyone is interested in grabbing this issue - here's some directions - it happens here:
What we could do is wrap this in try/catch and if exception was thrown use reporter.panicOnBuild function to display meaningful error - it should include node.absolutePath to point to file with maforrmatted frontmatter.
|
I'm interested in giving it a shot. I could use some guidance on the wording of the error. We could simply show the error message and append the file which triggered it, or we could supply some more text. @pieh I have some trouble with I just use it like this: |
@mslooten I think you are right about gatsby/packages/gatsby-cli/src/reporter/index.js Lines 53 to 58 in bbd2a46
As for the wording, yeah I think just adding filename in front of error would be good - so maybe something like:
|
@pieh yeah that does the trick, thanks for pointing me to the right file and the guidance on the wording. I'll start preparing a PR for this! |
Summary
gatsby-transformer-remark returns errors without specifying in which file it happens.
It should display this information.
Motivation
Context: I try to rewrite my website made with Hexo, using Gatsby.
One issue I stumbled upon is that my Markdown files were using a frontmatter with only three dashes at the end, working with Hexo, but ignored by Gatsby. So I had a mostly empty frontmatter in my GraphQL queries (only an empty title). I mention this in case it can help somebody with the same issue. Of course, it worked better once I added the three dashes at the start of the files...
My issue is that then, gatsby-transformer-remark reported Yaml errors. But it doesn't tell where they happened:
Here, the stack trace isn't very useful (but not a problem), but the "YAMLException: duplicated mapping key at line 18, column 2:" message just forgets to specify in which file this happens! Showing the path of the currently processed Markdown file would helps a lot!
Thanks for this very interesting tool. I struggle a bit to put bits and pieces in place, but I learn a lot in the process...
The text was updated successfully, but these errors were encountered: