Skip to content

rjz/http-error-factories

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HTTP error factories

Wraps jproulx's http-custom-errors 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

About

Factory functions for http-custom-errors

Resources

Stars

Watchers

Forks

Packages

No packages published