Package Exports
- bugsy
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (bugsy) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
bugsy
Collection of helpers to deal with errors.
Dealing with errors is a common problem in every kind of project. While a lot of libraries simply focus on their creation, this library is meant to deal whole way through their lifecycle.
Features
- Inheritance management
- Error severity support
- Matching transformations
- Flow definition
Installation
$ npm install bugsyUsage
import * as bugsy from 'bugsy';
const RanAwayError = bugsy.create(
'RanAwayError',
'It ran away, again',
{ code: 'ran_away' }
);
const MissedThrowError = bugsy.create(
'MissedThrowError',
'Throw totally missed',
{ code: 'missed_throw' }
);
function capture() {
if (Math.random() > 0.9) {
throw new MissedThrowError();
} else {
throw new RanAwayError({ meta: 'Caterpie' });
}
}
bugsy.transform(() => {
capture();
}, [
bugsy.code('missed_throw').drop(),
bugsy.instanceOf(RanAwayError).transform(err => err.level = bugsy.LEVELS_SYSLOG.EMERGENCY)
]);