An open API service indexing awesome lists of open source software.

https://github.com/queckezz/error-stack

extracts useful information from an error stack and allows you to skip certain steps
https://github.com/queckezz/error-stack

Last synced: 7 months ago
JSON representation

extracts useful information from an error stack and allows you to skip certain steps

Awesome Lists containing this project

README

          

# error-stack

extracts useful information from an error stack. Currently this has only been tested with v8 error stacks.

## Installation

```bash
$ npm install error-stack
```

## Api

### #parse(Error)

parse an `Error`'s stack object and returns a stack.

## Example

```js
var err = new Error('Oh noes!')
var stack = stack.parse(err)
```

transforms

```
Error: Oh noes!
at Suite. (/home/queckezz/dev/tmp/test/test/index.js:10:13)
at context.describe.context.context (/home/queckezz/dev/tmp/test/node_modules/mocha/lib/interfaces/bdd.js:74:10)
at Object. (/home/queckezz/dev/tmp/test/test/index.js:8:1)
at Module._compile (module.js:449:26)
...
```

into something more usable

```json
[
{
"call": "Suite.",
"file": "/home/queckezz/dev/tmp/test/test/index.js",
"row": "10",
"col": "13"
},
{
"call": "context.describe.context.context",
"file": "/home/queckezz/dev/tmp/test/node_modules/mocha/lib/interfaces/bdd.js",
"row": "74",
"col": "10"
},
{
"call": "Object.",
"file": "/home/queckezz/dev/tmp/test/test/index.js",
"row": "8",
"col": "1"
},
{
"call": "Module._compile",
"file": "module.js",
"row": "449",
"col": "26"
},
...
]
```

## Todo

* Handle multiple Error objects (ReferenceEror, RangeError, ...)
* Maybe extract node specific functions
* Support safari, firefox stacks

## License

The [MIT](http://opensource.org/licenses/MIT) License © 2014, Fabian Eichenberger