Skip to content

Instantly share code, notes, and snippets.

@rschooley
Created March 14, 2014 10:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rschooley/9545278 to your computer and use it in GitHub Desktop.
Save rschooley/9545278 to your computer and use it in GitHub Desktop.
//
// dependencies
//
var http = require('http');
//
// http error
// supports status code and message (optional)
//
function HttpError (statusCode, message) {
var err = new Error();
err.statusCode = statusCode || 500;
err.message = message || http.STATUS_CODES[err.statusCode];
return err;
};
//
// exports
//
module.exports = HttpError;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment