1.3.0 • Published 6 years ago
@flagcard/exception v1.3.0
@flagcard/exception
Exception lib for projects in javascript
Table of Contents
Installation
@flagcard/exception is available from npm.
$ npm i -S @flagcard/exceptionWhy ?
Centralize exceptions used in microservices
Documentation
BadRequestException
const { BadRequestException } = require('@flagcard/exception');
throw new BadRequestException('custon message');MethodNotAllowedException
const { MethodNotAllowedException } = require('@flagcard/exception');
throw new MethodNotAllowedException('custon message');NotFoundException
const { NotFoundException } = require('@flagcard/exception');
throw new NotFoundException('custon message');UnauthorizedUserException
const { UnauthorizedUserException } = require('@flagcard/exception');
throw new UnauthorizedUserException('custon message');Custom Exception
const { Exception } = require('@flagcard/exception');
class CustomException extends Exception {
constructor(message) {
super(message);
// do something fun
}
}License
The code is available under the MIT License.