Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

httperrors

Package Overview
Dependencies
Maintainers
2
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

httperrors - npm Package Compare versions

Comparing version 0.5.0 to 0.6.0

12

lib/httpErrors.js

@@ -45,4 +45,14 @@ var createError = require('createerror');

var httpErrors = module.exports = {};
var httpErrors = module.exports = function (options) {
if (typeof options === 'undefined') {
options = {};
} else if (typeof options === 'number') {
options = {statusCode: options};
}
options.status = options.statusCode;
return (httpErrors[options.statusCode] || httpErrors.Unknown)(options);
};
httpErrors.Unknown = createError({name: 'Unknown'});
/// Map the error codes/names, as defined in Node's [http

@@ -49,0 +59,0 @@ /// module](http://nodejs.org/docs/latest/api/http.html).

2

package.json

@@ -15,3 +15,3 @@ {

],
"version": "0.5.0",
"version": "0.6.0",
"repository": {

@@ -18,0 +18,0 @@ "type": "git",

@@ -21,2 +21,5 @@ node-httperrors

// Instatiate by status code:
var myError = httpErrors(412);
// Instantiate by name (UpperCamelCase):

@@ -23,0 +26,0 @@ var err = new httpErrors.NotFound('The thing you were looking for was not found');

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc