http-error-response
v1.0.2
Published
standard http error handler that follows sane conventions
Downloads
15
Readme
http-error-response
Standard http error handler that follows sane conventions:
- uses
error.statusand defaults to500 - when
NODE_ENV == "production", responds with terse status descriptions - in all other environments, responds with the
error.stackand renders nicely in browsers
Example
var http = require('http');
var onerror = require('http-error-response');
var server = http.createServer(function(req, res){
var err = new Error('oopsie');
onerror(req, res, err);
});Installation
$ npm install http-error-responseAPI
onerror(req, res, err)
License
MIT
