Beautifully formatted stack traces.
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.npmignore
Readme.md
example.png
index.js
package.json

Readme.md

stack-formatted

Beautifully formatted stack traces.

Install:

npm install stack-formatted

Usage:

require('stack-formatted');

console.log(new Error().stackFormatted);
// All error objects contain the stackFormatted property.

Example output:

Example of stack-formatted stack trace in the terminal.


We use stack-json to produce the nicely formatted output. You can also use trace to get long stack trace in asynchronous code (mainly for debugging):

require('stack-formatted');
require('trace'); // load it after this module

setTimeout(function() {
  try {
    explode;
  } catch (error) {
    console.log(error.stackFormatted);
  }
}, 100);