Extract the actual stack of an error
Install
$ npm install --save extract-stack
Usage
const extractStack = require('extract-stack');
const error = new Error('Missing unicorn');
console.log(error.stack);
console.log(extractStack(error));
console.log(extractStack.lines(error));
API
It gracefully handles cases where the stack is undefined or empty and returns an empty string.
Returns the actual stack part of the error stack.
Returns the stack lines of the error stack without the noise as an Array
.
input
Type: Error
string
Either an Error
or the .stack
of an Error
.
Related
License
MIT © Sindre Sorhus