error-stack
Parse and manipulate error.stack
Install
$ npm i error-stack
Usage
const parse = const stack = 'foo' console// Error: foo// at repl:1:11// at Script.runInThisContext (vm.js:123:20) const parsed = parsedtype // Error parsedmessage // foo parsedtraces// [// {// callee: undefined,// source: 'repl',// line: 1,// col: 11// },// {// callee: 'Script.runInThisContext',// source: 'vm.js',// line: 123,// col: 20// }// ] parsed// Error: foo// at Script.runInThisContext (vm.js:123:20)
string
parsed.type Error type
string
parsed.message The message used by Error constructor
Array<Trace>
parsed.traces
parsed.filter(filterFunction): this
- filterFunction
Function
the same as the callback function ofArray.prototype.filter(callback)
Filters the current traces
parsed.format(): string
Format object parsed