prepare-stack-trace
v0.0.4
Published
Error.prepareStackTrace ponyfill for Node. Made for Cabin.
Downloads
121
Readme
prepare-stack-trace
Error.prepareStackTrace
ponyfill for Node. Made for Cabin.
Table of Contents
Install
npm:
npm install prepare-stack-trace
yarn:
yarn add prepare-stack-trace
Usage
Node
const StackFrame = require('stackframe');
const ErrorStackParser = require('error-stack-parser');
const prepareStackTrace = require('prepare-stack-trace');
const err1 = new Error('Oops!');
const err2 = new Error('Error 1 will inherit this stack trace');
err1.stack = prepareStackTrace(err1, ErrorStackParser.parse(err2));
console.log('err1', err1);
console.log('err2', err2);
VanillaJS
<script src="https://unpkg.com/stackframe"></script>
<script src="https://unpkg.com/error-stack-parser"></script>
<script src="https://unpkg.com/prepare-stack-trace"></script>
<script type="text/javascript">
(function() {
var err1 = new Error('Oops!');
var err2 = new Error('Error 1 will inherit this stack trace');
err1.stack = prepareStackTrace(err1, ErrorStackParser.parse(err2));
console.log('err1', err1);
console.log('err2', err2);
})();
</script>
Contributors
| Name | Website | | -------------- | -------------------------- | | Nick Baugh | http://niftylettuce.com/ |