Error-stack-parser

error-stack-parser

Simple, cross-browser Error parser.

error-stack-parser library parses and extracts function names, URLs, line numbers, and column numbers from the given Error's stack as an Array of StackFrames.

Get it: npm install error-stack-parser

Sample usage:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
const ErrorStackParser = rquire("error-stack-parser);

ErrorStackParser.parse(new Error('BOOM'));

/*
=> [
        StackFrame({functionName: 'foo', args: [], fileName: 'path/to/file.js', lineNumber: 35, columnNumber: 79, isNative: false, isEval: false}),
        StackFrame({functionName: 'Bar', fileName: 'https://cdn.somewherefast.com/utils.min.js', lineNumber: 1, columnNumber: 832, isNative: false, isEval: false, isConstructor: true}),
        StackFrame(... and so on ...)
   ]
*/

Object.keys(ErrorStackParer);

/*
[ 'parse',
  'extractLocation',
  'parseV8OrIE',
  'parseFFOrSafari',
  'parseOpera',
  'parseOpera9',
  'parseOpera10',
  'parseOpera11' ]
*/

GIF FTW!

error-stack-parser

Suggest a module

Comments