Socket
Book a DemoInstallSign in
Socket

http-error-response

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

http-error-response

standard http error handler that follows sane conventions

latest
Source
npmnpm
Version
1.0.2
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

http-error-response

Standard http error handler that follows sane conventions:

  • uses error.status and defaults to 500
  • when NODE_ENV == "production", responds with terse status descriptions
  • in all other environments, responds with the error.stack and 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-response

API

onerror(req, res, err)

License

MIT

FAQs

Package last updated on 12 Dec 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts