Easy to use, class-based http errors. Supports all http statuses.
yarn add @sadbox/node-http-errors
or
npm install -S @sadbox/node-http-errors
import { HttpError, BadRequest } from '@sadbox/node-http-errors';
let err = new HttpError({ status: 500, message: 'Internal Server Error.' });
err = new BadRequest(); // status 400 and default message for bad request error
err = new BadRequest('Bad User Input.'); // with custom message
err = new BadRequest({ fieldErrors }); // with custom property