fix: handle unexpected errors - #2368
Merged
3 commits merged intoNov 29, 2021
Merged
Conversation
ghost
force-pushed
the
feat/handle-unexpected-errors
branch
6 times, most recently
from
November 19, 2021 20:40
713d244 to
738efe5
Compare
ghost
commented
Nov 25, 2021
ghost
left a comment
Author
There was a problem hiding this comment.
Self-review based on in-person discussions.
| * This function can only be used once in the same process. If you have multiple | ||
| * callables needing this, compose them into a single callable. | ||
| */ | ||
| export async function callHandlingUnexpectedErrors( |
Author
There was a problem hiding this comment.
@maxjeffos how about "safelyCall". Seems like a more minimal solution (vs. inventing an understandable DSL). Might be too generic...
added 3 commits
November 25, 2021 20:54
Ensure unexpected errors are handled with Exit Code 2 rather than the NodeJS default 1. We use 1 for vulns found. Node 16 now uses Exit Code 1 for unhandledRejections (rather than only logging), so this also makes us consistent across different Node versions.
Need to wrap index logic in an error handler but doing so will lose file history. This commit will be followed by a new index.js
ghost
force-pushed
the
feat/handle-unexpected-errors
branch
from
November 25, 2021 20:55
738efe5 to
a8835ab
Compare
|
This PR modifies files linked to issues tracked in Stepsize. You might want to review their status, priority, and scope.
|
This pull request was closed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ensure unexpected errors are handled with Exit Code 2 rather than the NodeJS default 1. We use 1 for vulns found.
Node 16 now uses Exit Code 1 for unhandledRejections (rather than only logging), so this also makes us consistent across different Node versions.
https://nodejs.org/en/blog/release/v15.0.0/#throw-on-unhandled-rejections-33021
Note for Reviewers
When reviewing, it's best to review through each commit.
I've moved a file and placed a new file in its old place. To avoid losing history, these two steps are in separate commits.
If I didn't do this, git will squash the two changes to look like I deleted a bunch of code and created a new file with a bunch of new code. Obviously, that's not correct. This is what GitHub's PR interface also shows, but it's not how it looks in history with separate commits.
Notes