- Notifications
You must be signed in to change notification settings - Fork744
Safely exit by throwing an error#546
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
nfischer commentedNov 2, 2016
Is there a way to make the message be part of the new stack trace? That would be even better. |
freitagbr commentedNov 2, 2016
Do you mean the |
nfischer commentedNov 2, 2016
Yeah, that's what I meant |
nfischer commentedNov 3, 2016
@freitagbr is it standard to prepend to the message like that? |
freitagbr commentedNov 3, 2016 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Probably not, so I will suggest a different option: changing the error name to |
nfischer commentedNov 3, 2016
@freitagbr that could work |
freitagbr commentedNov 11, 2016
I toyed around with the idea of creating an internal error class, but in this instance, I think just changing the name should suffice. |
nfischer commentedNov 14, 2016
LGTM. Moving this to the dev branch since it's a breaking change. Hopefully we don't have to worry about unexpected scenarios where you can't assign to properties of exception is caught. This approach should be perfectly fine for any real exception. |
nfischer commentedJan 17, 2017
@freitagbr it looks like we may have lost this commit on dev branch with a force push (I wish github supported auto merging). I'll just stick with manual merges instead of rebases to update dev branch. Would you be able to redo this commit? |
freitagbr commentedJan 17, 2017
Yeah, let me do redo this. |
Fixes#483.
Instead of exiting the process with
process.exit(1), simply throw an error. This way, the error can be caught by Node itself. If the error is not caught, the error is still printed, and the process exits with a1.