HttpError
.
This README needs some love.
const HttpError = require('@maxtruxa/http-error');
throw new HttpError(404, {url: 'https://example.com/test'});
npm install @maxtruxa/http-error
const HttpError = require('@maxtruxa/http-error');
// HttpError(code[, message][, properties])
// HttpError(properties)
throw new HttpError(404);
throw new HttpError(404, 'some message');
throw new HttpError(404, {additional: 'information'});
throw new HttpError(404, 'some message', {additional: 'information'});
throw new HttpError({code: 404, additional: 'information'});
To run the test suite, install dependencies, then run npm test
:
npm install
npm test
Coverage reports are generated by running npm run coverage
.
Linting is done with npm run lint
.