Package Exports
- prepare-stack-trace
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (prepare-stack-trace) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
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/ |