v8stack
v0.1.1
Published
Access V8 error stack traces
Downloads
3
Maintainers
Readme
v8stack
is an npm package for accessing V8's error
stack traces.
Installation
npm install v8stack
Usage
// 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'.