node package manager
Love JavaScript? Your insights can make it even better. Take the 2017 JavaScript Ecosystem Survey »


Super stack trace

Build Status npm

It provides support for “long stack traces,” wherein the stack property of Error rejection reasons is rewritten to be traced along asynchronous jumps instead of stopping at the most recent one.

The heavy lifting is made by async-listener, which is a polyfill for an experimental API that had a short-life in node.js (v0.11.x only) and was removed.


$ npm install superstacktrace

Tested on latest iojs


// That's it. 

Stack trace example:

Error: Unhandled error!
    at /home/user/project/test/test.js:166:23
    at /home/user/project/node_modules/async-listener/glue.js:188:31
    at process._tickDomainCallback [as _tickCallback] (node.js:366:13)
From previous event:
    at asyncWrap (/home/user/project/node_modules/async-listener/glue.js:150:28)
    at wrapCallback (/home/user/project/node_modules/async-listener/glue.js:401:35)
    at process.nextTick (/home/user/project/node_modules/async-listener/index.js:16:26)
    at myNestedFunction [as _onTimeout] (/home/user/project/test/test.js:165:25)
    at Timer.listOnTimeout (timers.js:89:15)

There are some lines including the async-listener library, I thought about filtering them, but then I realise, if that's the real cause of the error it would be hidden.

Running tests

$ mocha