@ozylog/http-errors

1.1.0 • Public • Published

http-errors

Create HTTP error objects

Travis npm

Installation

npm install @ozylog/http-errors --save

List of errors

new BadRequestError([message = 'Bad Request'])
new ForbiddenError([message = 'Forbidden'])
new InternalServerError([message = 'Internal Server Error'])
new NotAcceptableError([message = 'Not Acceptable'])
new NotFoundError([message = 'Not Found'])
new NotImplementedError([message = 'Not Implemented'])
new UnauthorizedError([message = 'Unauthorized'])
new CreateError([message], [statusCode])

Usage Example

import {BadRequestError} from '@ozylog/http-errors';

export function validate(req, res, next) {
  if (!req.body.name) return next(new BadRequestError());
}

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i @ozylog/http-errors

Weekly Downloads

3

Version

1.1.0

License

SEE LICENSE IN LICENSE

Last publish

Collaborators

  • cahyap