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

fix: ensure that errorParser always returns something #20749

Merged
merged 2 commits into from
Mar 13, 2020

Conversation

mathieudutour
Copy link
Contributor

Description

This makes api-runner-error-parser a bit more robust by returning a default error if we didn't manage to parse it.

I'll fix the gatsby-plugin-manifest in another PR

Copy link
Contributor

@blainekasten blainekasten left a comment

Choose a reason for hiding this comment

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

Happy to see this change go through, mind adding a test to confirm its use?

@pieh
Copy link
Contributor

pieh commented Jan 22, 2020

Could we maybe change our handlers and looping over handlers so the
// Match anything with a generic catch-all error handler handler just doesn't have regex test (to trully catch-all) and inside loop see if there is no regex test, just match it? Alternatively remove catch-all handler from handlers array and rely on this newly added catch-all case? To me it seems we have "duplicate" catch-all error handlers where one is not trully catch-all right now in this PR

@mathieudutour mathieudutour force-pushed the mathieudutour-patch-1-1 branch from 583d715 to 4d109ab Compare March 13, 2020 12:57
@pieh pieh changed the title Ensure that errorParser always returns something fix: ensure that errorParser always returns something Mar 13, 2020
@pieh pieh self-assigned this Mar 13, 2020
Copy link
Contributor

@pieh pieh left a comment

Choose a reason for hiding this comment

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

This is awesome! Thank you!

Additionally on top of fixing non-error throws - it also restores stack trace that was missing recently (err was assigned string so error: err instanceof Error ? err : undefined was always undefined)

@pieh pieh dismissed blainekasten’s stale review March 13, 2020 14:10

tests were added

@pieh pieh merged commit 2688f29 into master Mar 13, 2020
@delete-merged-branch delete-merged-branch bot deleted the mathieudutour-patch-1-1 branch March 13, 2020 14:11
@pieh
Copy link
Contributor

pieh commented Mar 13, 2020

Published in gatsby@2.19.42

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.

3 participants