exceptionable

0.0.5 • Public • Published

exceptionable Build Status

what?

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.

install

npm install --save exceptionable

usage

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');

custom handling

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');
    }
}

/exceptionable/

    Package Sidebar

    Install

    npm i exceptionable

    Weekly Downloads

    36

    Version

    0.0.5

    License

    MIT

    Last publish

    Collaborators

    • icodeforlove