promise-debug
v0.1.1
Published
Got an unhandled promise rejection you can't find? This lib is for you.
Downloads
27
Readme
promise-debug
Wraps JavaScript promises to add ids, original stack traces, and readable output
Usage
global.Promise = require('promise-debug');
Now, your promises will have several new properties:
id
: a unique identifier for the promiseoriginalStack
: the stack trace when the promise constructor was calledexecutor
: the executor function
To print out the stack trace for a promise with an unhandled rejection, use this:
process.on('unhandledRejection', (err, promise) => {
console.log('UnhandledRejection:', promise.originalStack);
});