prepare-stack-trace

0.0.4 • Public • Published

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

Name Website
Nick Baugh http://niftylettuce.com/

License

MIT © Nick Baugh

Dependencies (0)

    Dev Dependencies (23)

    Package Sidebar

    Install

    npm i prepare-stack-trace

    Weekly Downloads

    540

    Version

    0.0.4

    License

    MIT

    Unpacked Size

    10.1 kB

    Total Files

    9

    Last publish

    Collaborators

    • niftylettuce
    • titanism