Feature request: add global handling for unhandled promise rejection
See original GitHub issueAs explained at http://thecodebarbarian.com/unhandled-promise-rejections-in-node.js.html, given now “promise heavy” is current api, this is very useful for debugging.
I’d like you to consider:
- Automatic logging into console of all unhandled promise rejections,
- Addition of
unhandledRejectionEventevent to application, similar to currentuncaughtErrorEventone.
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource. </bountysource-plugin>
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Create a Global Promise Rejection Handler | Pluralsight
This guide will demonstrate how to take this a step further and add a global promise rejection handler so that you can capture...
Read more >Unhandled Promise Rejections in Node.js - The Code Barbarian
The node process global has an unhandledRejection event for unhandled promise rejection. Bluebird also emits this event, so if you do global.
Read more >unhandled promise rejection with react app - Stack Overflow
So I tried to run npm start and i got : "(node:4786) UnhandledPromiseRejectionWarning: Unhandled promise rejection ...
Read more >Node.js 15 Is Out! What Does It Mean for You? - Maxim Orlov
// Global handler for unhandled promise rejections process.on('unhandledRejection', (reason, promise) => ...
Read more >Window: unhandledrejection event - Web APIs | MDN
The unhandledrejection event is sent to the global scope of a script when a JavaScript Promise that has no rejection handler is rejected; ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@tsonevn I am not sure how tracing is related to the subject. Tracing is tracing, error handling is error handling. Right now exceptions inside promise
thenchains fail silently, and require wrapping all promise calls withcatchclauses. While it’s possible to do, it’s burdensome and inefficient. It’s somewhat similar to wrapping all calls intry / catch, which luckily no-one has to do.Although it might be burdensome to add catch statements everywhere, it’s probably a good idea. Node will soon require that you always catch errors on promises, or it will exit the process
It’s also a good idea because oftentimes you can recover from an error in a catch(). If it was a global catch, the best you could most-likely do would be exit/restart the application