Skip to content

Instantly share code, notes, and snippets.

@juliangruber
Created May 26, 2013 16:29
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 juliangruber/5653265 to your computer and use it in GitHub Desktop.
Save juliangruber/5653265 to your computer and use it in GitHub Desktop.
function _error (req, res) {
return function (str) {
// set status code etc...
res.end(str);
}
}
// Usage:
http.createServer(function (req, res) {
var error = _error(req, res);
// do some things...
return error('oh noes!');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment