0.3.3 • Published 7 years ago

error-trapper v0.3.3

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

Error Trapper

Build Status npm version Dependency Status devDependency Status MIT Licence

Install

Install from npm: npm install -D error-trapper

And add babel-macros plugin to your babel config.

Usage

For wrap function:

import initialize from 'error-trapper';
import WRAP from 'error-trapper/macros/wrap-function.macro';

initialize( `${window.location.hash}../node_modules/error-trapper/lib/esprima-bundle.js` );

WRAP( () => {
    const foo = { firstName: 'Andy' };
    const bar = foo.lastName.toString;
}, ( e, scope ) => {
    console.dir( scope );
} )();

Console output:

Console output

Or print with ErrorTrap.printContext:

Console output

For parse scope:

import initialize from 'error-trapper';
import PARSE_SCOPE from 'error-trapper/macros/parse-scope.macro';

initialize( `${window.location.hash}../node_modules/error-trapper/lib/esprima-bundle.js` );

try {
    const foo = { firstName: 'Andy' };
    const bar = foo.lastName.toString;
} catch (e) {
    PARSE_SCOPE( ( scope ) => {
        console.dir( scope );
    } );
}
0.3.3

7 years ago

0.3.2

7 years ago

0.3.1

7 years ago

0.3.0

7 years ago

0.2.0

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago