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(api-runner-node): build should stop on error #4347

Merged
merged 2 commits into from
Mar 7, 2018

Conversation

anjawaldbauer
Copy link
Contributor

If a plugin throws an error, the build should stop and exit with an error exit code, not just log the error and continue the build.

Possibly related to #4070

@gatsbybot
Copy link
Collaborator

Deploy preview for gatsbygram ready!

Built with commit 8ad0f34

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

@gatsbybot
Copy link
Collaborator

gatsbybot commented Mar 3, 2018

Deploy preview for gatsbygram ready!

Built with commit 195e96c

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

@@ -161,7 +161,7 @@ module.exports = async (api, args = {}, pluginSource) =>
},
(err, results) => {
if (err) {
reporter.error(`${pluginName} returned an error`, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Since panicOnBuild doesn't exist, you can do the same thing by adding a conditional if (process.env.NODE_ENV === "production") { /* panic */ } else { /* error */ }

If a plugin throws an error, the build should stop and exit with an error exit code, not just log the error and continue the build.
@anjawaldbauer
Copy link
Contributor Author

@KyleAMathews Thanks, good point! I saw you closed the issue related to v2, but maybe we can still get this out as a fix?

@KyleAMathews
Copy link
Contributor

Yup, happy to publish this work around. Thanks for PRing it!

Check out TravisCI — there's a lint error.

@anjawaldbauer
Copy link
Contributor Author

anjawaldbauer commented Mar 7, 2018

@KyleAMathews Thanks for the hint and sorry for the time consuming back and forth. Ready for merge imo.

@KyleAMathews KyleAMathews merged commit ae75335 into gatsbyjs:master Mar 7, 2018
@KyleAMathews
Copy link
Contributor

Thanks!

@anjawaldbauer anjawaldbauer deleted the panic-on-error branch March 8, 2018 08:07
@jlengstorf
Copy link
Contributor

Hiya @anjawaldbauer! 👋

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.

4 participants