Decorator that allows you to swallow exceptions.
This should be used with care, if you really need something like this it can be useful, but if you don't it can also be a footgun.
npm install --save exceptionable
you can define a universal decorator like this
import exceptionable from 'exceptionable';
class Example {
@exceptionable
static canError () {
throw new Error('abcd');
}
}
console.log('before error');
Example.canError();
console.log('after error');
you can handle error logging in a custom way as well
const debug = requre('debug')('example');
@exceptionable({handler: error => debug(error.stack)})
class Example {
static canError () {
throw new Error('abcd');
}
}