Skip to content
This repository has been archived by the owner on Feb 20, 2021. It is now read-only.

maxtruxa/http-error

Repository files navigation

@maxtruxa/http-error

npm Version npm Downloads Test Status Test Coverage MIT Licensed

HttpError.

This README needs some love.

const HttpError = require('@maxtruxa/http-error');

throw new HttpError(404, {url: 'https://example.com/test'});

Installing

npm install @maxtruxa/http-error

Features

Usage

Direct Usage

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'});

Inheriting

API

Tests

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.

About

Extensible HTTP error class for Node.js

Resources

License

Stars

Watchers

Forks

Packages

No packages published