-
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
feat(gatsby): improve error messages at runtime #29970
Conversation
@@ -103,6 +78,12 @@ const runSuiteForPage = (label, pagePath) => { | |||
filter: `page-data`, | |||
}) | |||
}) | |||
describe(`Missing "${label}" static query results`, () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We weren't tested static-query blocked
asyncRequires.components[chunkName]() | ||
.then(preferDefault) | ||
// loader will handle the case when component is error | ||
.catch(err => err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Return the error instead of throwing
throw new Error( | ||
`We couldn't find the correct component chunk with the name "${chunkName}"` | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We silently fail, now we don't
Probably good to backport this to v2, it will need small change in the cherry-pick PR. Develop wasn't using async-requires |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM. Non blocking (maybe as follow-up): Can we give clearer instructions on how people might solve their issue? We're outputting more detailed errors now, but they are the nitty gritty details. I could imagine a link to a specific docs page for example
I agree but the issue is that I don't know yet why they happen. |
(cherry picked from commit d37f275)
(cherry picked from commit d37f275)
(cherry picked from commit d37f275)
Description
Adding some better error messages in our runtime code so people can actually see what's going wrong in their error trackers.
It should help us solve #19618
When you have a runtime error in your page component before React kicks in
When Static Query fails we got an unexpected JSON error, now we get:

When Page Query fails, it's still the same:

Related Issues
Related to #19618