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
- Host: GitHub
- URL: https://github.com/queckezz/error-stack
- Owner: queckezz
- Created: 2014-06-22T17:08:14.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2014-06-22T18:13:51.000Z (over 11 years ago)
- Last Synced: 2025-01-20T18:35:42.730Z (9 months ago)
- Language: JavaScript
- Homepage:
- Size: 133 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- Changelog: history.md
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