[d565449] | 1 | error-stack-parser.js - Extract meaning from JS Errors
|
---|
| 2 | ===============
|
---|
| 3 | [![Build Status](https://img.shields.io/github/workflow/status/stacktracejs/error-stack-parser/Continuous%20Integration/master?logo=github&style=flat-square)](https://github.com/stacktracejs/error-stack-parser/actions?query=workflow%3AContinuous+Integration+branch%3Amaster)
|
---|
| 4 | [![Coverage Status](https://img.shields.io/coveralls/stacktracejs/error-stack-parser.svg?style=flat-square)](https://coveralls.io/r/stacktracejs/error-stack-parser?branch=master)
|
---|
| 5 | [![GitHub license](https://img.shields.io/github/license/stacktracejs/error-stack-parser.svg?style=flat-square)](https://opensource.org/licenses/MIT)
|
---|
| 6 | [![size with dependencies](https://img.shields.io/badge/size-4.8k-green.svg?style=flat-square)](https://github.com/stacktracejs/error-stack-parser/releases)
|
---|
| 7 | [![gzip size](https://img.shields.io/badge/gzipped-1.8k-green.svg?style=flat-square)](https://github.com/stacktracejs/error-stack-parser/releases)
|
---|
| 8 | [![module format](https://img.shields.io/badge/module%20format-umd-lightgrey.svg?style=flat-square&colorB=ff69b4)](https://github.com/stacktracejs/error-stack-parser/releases)
|
---|
| 9 | [![code of conduct](https://img.shields.io/badge/code%20of-conduct-lightgrey.svg?style=flat-square&colorB=ff69b4)](http://todogroup.org/opencodeofconduct/#stacktrace.js/me@eriwen.com)
|
---|
| 10 | [![jsDelivr Hits](https://data.jsdelivr.com/v1/package/npm/error-stack-parser/badge)](https://www.jsdelivr.com/package/npm/error-stack-parser)
|
---|
| 11 |
|
---|
| 12 | Simple, cross-browser [Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) parser.
|
---|
| 13 | This library parses and extracts function names, URLs, line numbers, and column numbers from the given Error's `stack` as
|
---|
| 14 | an Array of [StackFrame](http://git.io/stackframe)s.
|
---|
| 15 |
|
---|
| 16 | Once you have parsed out StackFrames, you can do much more interesting things. See [stacktrace-gps](http://git.io/stacktrace-gps).
|
---|
| 17 |
|
---|
| 18 | Note that in IE9 and earlier, `Error` objects don't have enough information to extract much of anything. In IE 10, `Error`s
|
---|
| 19 | are given a `stack` once they're `throw`n.
|
---|
| 20 |
|
---|
| 21 | ## Browser Support
|
---|
| 22 | [![Sauce Test Status](https://saucelabs.com/browser-matrix/stacktracejs.svg)](https://saucelabs.com/u/stacktracejs)
|
---|
| 23 |
|
---|
| 24 | ## Usage
|
---|
| 25 | ```js
|
---|
| 26 | ErrorStackParser.parse(new Error('BOOM'));
|
---|
| 27 |
|
---|
| 28 | => [
|
---|
| 29 | StackFrame({functionName: 'foo', args: [], fileName: 'path/to/file.js', lineNumber: 35, columnNumber: 79, isNative: false, isEval: false}),
|
---|
| 30 | StackFrame({functionName: 'Bar', fileName: 'https://cdn.somewherefast.com/utils.min.js', lineNumber: 1, columnNumber: 832, isNative: false, isEval: false, isConstructor: true}),
|
---|
| 31 | StackFrame(... and so on ...)
|
---|
| 32 | ]
|
---|
| 33 | ```
|
---|
| 34 |
|
---|
| 35 | ## Installation
|
---|
| 36 | ```bash
|
---|
| 37 | npm install error-stack-parser
|
---|
| 38 | bower install error-stack-parser
|
---|
| 39 | https://raw.githubusercontent.com/stacktracejs/error-stack-parser/master/dist/error-stack-parser.min.js
|
---|
| 40 | ```
|
---|
| 41 |
|
---|
| 42 | ## Contributing
|
---|
| 43 | Want to be listed as a *Contributor*? Start with the [Contributing Guide](.github/CONTRIBUTING.md)!
|
---|
| 44 |
|
---|