https://github.com/n-riesco/v8stack
npm package for accessing V8 error stack traces
https://github.com/n-riesco/v8stack
Last synced: 2 months ago
JSON representation
npm package for accessing V8 error stack traces
- Host: GitHub
- URL: https://github.com/n-riesco/v8stack
- Owner: n-riesco
- License: other
- Created: 2015-11-20T15:32:09.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-11-21T08:42:36.000Z (over 9 years ago)
- Last Synced: 2025-03-14T16:06:23.863Z (3 months ago)
- Language: JavaScript
- Size: 16.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
`v8stack` is an [npm package](https://www.npmjs.com/) for accessing [V8's error
stack traces](https://github.com/v8/v8/wiki/Stack%20Trace%20API).# Installation
```
npm install v8stack
```# Usage
```javascript
// Import the `v8stack` package
var v8stack = require("v8stack");// Enable the capture of V8's stack traces
v8stack.enable();// Access V8's stack trace of an error object
var error = new Error();
var errorStack = v8stack.evaluate(error);
console.log(errorStack[0].getTypeName());// If wanted, the capture can be stopped
v8stack.disable();// Beware that error stacks are evaluated lazily.
// Evaluation can be triggered by calling `v8stack.get(error)`
// or by evaluating `error.stack`.
// After invoking `v8stack.disable()`, calls to `v8stack.evaluate(error)`
// with errors whose stack evaluation hasn't been trigerred
// will return 'undefined'.
```