-
Notifications
You must be signed in to change notification settings - Fork 163
Fix unhandled promise rejection tracker, again #1049
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
base: master
Are you sure you want to change the base?
Conversation
@ChALkeR mind taking a look? |
#1038 (comment) now works #1038 (comment) doesn't
|
Simplified testcase: const promise = Promise.reject('reject')
const error = await Promise.resolve().then(() => promise).catch(e => e)
console.log('Got this error:', error) This still crashes the process |
Actually a simpler one: const promise = Promise.reject('reject')
print(promise) |
Back to the drawing board :-) |
Node.js disagrees on that and treats that as unhandled (unlike the other examples above) |
Latest commit doesn't catch this anymore: async function foo() {
throw new Error('failed')
}
foo()
const setTimeout = globalThis.setTimeout || os.setTimeout
setTimeout(() => console.log('done'), 1000) |
You're right... |
51b4dda
to
1c395ba
Compare
Removed the latest commit. I need to see how to tell those 2 cases appart. |
That depends on the event loop In Node.js:
|
1c395ba
to
0452dfe
Compare
Delay checking for unhandled rejections so we can make sure to check after other promise jobs have ran.
0452dfe
to
8c43cf9
Compare
@bnoordhuis PTAL again, I changed the approach. The way it currently works |
@ChALkeR do your worst :-) |
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.
Checking for specific callbacks seems a little fragile but I don't have a better suggestion.
Mark a rejected promise as handled if we are passing it as as a resolution up a promise chain.