The right way to show the full stack for ES6 Promise unhandled failures is to run Node.js with the --trace-warnings . This will show a complete snippet for each warning, without having to intercept the deviation inside your own code. For example:
node --trace-warnings app.js
If you want to actually handle the raw rejects (for example, by registering them), you can use my unhandled-rejection module instead, which catches all the raw rejects for each main Promises implementation that supports it, with one event handler.
This module supports Bluebird, ES6 Promises, Q, WhenJS, es6-promise , then/promise and everything that matches any of the raw rejection specifications (full details in the documentation).
Sven Slootweg Dec 19 '17 at 22:02 2017-12-19 22:02
source share