Skip to content

Repository files navigation

Error Trapper

Build Statusnpm versionDependency StatusdevDependency StatusMIT Licence

Install

Install from npm: npm install -D error-trapper

And add babel-macros plugin to your babel config.

Usage

For wrap function:

importinitializefrom'error-trapper';importWRAPfrom'error-trapper/macros/wrap-function.macro';initialize(`${window.location.hash}../node_modules/error-trapper/lib/esprima-bundle.js`);WRAP(()=>{constfoo={firstName: 'Andy'};constbar=foo.lastName.toString;},(e,scope)=>{console.dir(scope);})();

Console output:

Console output

Or print with ErrorTrap.printContext:

Console output

For parse scope:

importinitializefrom'error-trapper';importPARSE_SCOPEfrom'error-trapper/macros/parse-scope.macro';initialize(`${window.location.hash}../node_modules/error-trapper/lib/esprima-bundle.js`);try{constfoo={firstName: 'Andy'};constbar=foo.lastName.toString;}catch(e){PARSE_SCOPE((scope)=>{console.dir(scope);});}

About

Parse & evalute exception's scope

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages