Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rjz/http-error-factories
Factory functions for http-custom-errors
https://github.com/rjz/http-error-factories
Last synced: 17 days ago
JSON representation
Factory functions for http-custom-errors
- Host: GitHub
- URL: https://github.com/rjz/http-error-factories
- Owner: rjz
- Created: 2014-07-13T14:58:03.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-08-16T14:20:40.000Z (over 10 years ago)
- Last Synced: 2024-10-22T12:06:34.848Z (2 months ago)
- Language: JavaScript
- Size: 129 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# HTTP error factories
Wraps [jproulx](https://github.com/jproulx)'s
[`http-custom-errors`](https://github.com/jproulx/node-http-error) with
friendly-named factory functions. All credit there--this extension is a matter
of syntactic preference only.### Install
npm install http-error-factories
### Usage
Factories are defined for each error name, using the lower camelcased name of
the corresponding error object. Each factory takes a single (optional) argument
representing a description of the error.var errors = require('http-error-factories');
var error = errors.internalServer('Something went horribly wrong');
error instanceof errors.HTTPError // true
error instanceof errors.InternalServerError // true