promise-debug

0.1.1 • Public • Published

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 promise
  • originalStack: the stack trace when the promise constructor was called
  • executor: 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);
});

/promise-debug/

    Package Sidebar

    Install

    npm i promise-debug

    Weekly Downloads

    4

    Version

    0.1.1

    License

    none

    Unpacked Size

    12.7 kB

    Total Files

    5

    Last publish

    Collaborators

    • vkarpov15