Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

error-stack-parser

stacktracejs39.7mMIT2.1.4TypeScript support: included

Extract meaning from JS Errors

stacktrace, error, stack, parser

readme

error-stack-parser.js - Extract meaning from JS Errors

Build Status Coverage Status GitHub license size with dependencies gzip size module format code of conduct jsDelivr Hits

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

Once you have parsed out StackFrames, you can do much more interesting things. See stacktrace-gps.

Note that in IE9 and earlier, Error objects don't have enough information to extract much of anything. In IE 10, Errors are given a stack once they're thrown.

Browser Support

Sauce Test Status

Usage

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 ...)
   ]

Installation

npm install error-stack-parser
bower install error-stack-parser
https://raw.githubusercontent.com/stacktracejs/error-stack-parser/master/dist/error-stack-parser.min.js

Contributing

Want to be listed as a Contributor? Start with the Contributing Guide!

changelog

v2.0.0

  • Update stackframe dependency to v1.x. Stackframes are constructed and accessed differently. See the stackframe CHANGELOG for details.

v1.3.6

  • Handle stack frames with no line/column information

v1.3.4

  • Avoid <anonymous> file names

v1.3.2

  • Handle Safari stack entries with no location information

v1.3.0

  • Significantly improved handling of eval()
  • Add many browsers to CI

v1.2.2

  • Handle native functions in V8 stack traces

v1.2.0

  • Propagate "(native)" locations instead of defaulting to undefined

v1.1.1

  • Make sure to include direct dependencies in distributed JS files

v1.1.0

  • Move polyfills to separate, optional file
  • Better docs

v1.0.0

  • Fully tested on old IEs, production-ready

v0.2.4

  • Fix moar boogs with Opera impl

v0.2.3

  • Fix boogs with Opera impl

v0.2.2

  • Name functions such that they can can be filtered out by stacktrace.js

v0.2.1

  • Provide standard distribution (minified and unminified).
  • Slimmer node package

v0.2.0

  • Remove constructor
  • Fix boogs

v0.1.0

  • Re-write from stacktrace.js