Skip to content

stacktracejs/error-stack-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Jun 6, 2022
9f33c22 · Jun 6, 2022
Jun 5, 2022
Jun 6, 2022
Oct 7, 2021
Apr 1, 2016
Jun 5, 2022
Sep 18, 2019
Feb 17, 2022
Dec 1, 2016
May 18, 2017
Feb 17, 2022
May 18, 2017
Dec 1, 2016
Jun 6, 2022
Jun 6, 2022
Apr 16, 2016
Jun 5, 2022
Jun 5, 2022
Jun 6, 2022
Jun 6, 2022

Repository files navigation

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!