@weaverkit/errors
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

@weaverkit/errors

TODO: description

Usage

const { ErrorHandler, HttpError, InvalidActionError, UnauthorizedError } = require('@weaverkit/errors');

// TODO: DEMONSTRATE API
const handler = new ErrorHandler();
handler.on("handle", (error) => {
    // do stuff like log error
});

try {
    throw new UnauthorizedError('User is not authorized to perform this action)
    .setContext({
        userId: 1
    });
} 
catch (error) {
    handler.handle(error);
}

Readme

Keywords

none

Package Sidebar

Install

npm i @weaverkit/errors

Weekly Downloads

44

Version

0.1.2

License

MIT

Unpacked Size

30.8 kB

Total Files

5

Last publish

Collaborators

  • iyiolapeter