0.0.4 • Published 5 years ago

prepare-stack-trace v0.0.4

Weekly downloads
13
License
MIT
Repository
github
Last release
5 years ago

prepare-stack-trace

build status code coverage code style styled with prettier made with lass license

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

NameWebsite
Nick Baughhttp://niftylettuce.com/

License

MIT © Nick Baugh