Error.prepareStackTrace
ponyfill for Node. Made for Cabin.
npm:
npm install prepare-stack-trace
yarn:
yarn add prepare-stack-trace
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);
<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>
Name | Website |
---|---|
Nick Baugh | http://niftylettuce.com/ |