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

http-verror

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

http-verror - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

.travis.yml

37

lib/index.js

@@ -11,2 +11,14 @@ /**

var httpErrors = {
400: { name: 'BadRequest', description: 'Invalid data was sent to the server' },
401: { name: 'Unauthenticated', description: 'You\'re not authorized to perform such action' },
403: { name: 'Forbidden', description: 'You\'re not allowed to perform such action' },
404: { name: 'NotFound', description: 'Resource was not found' },
409: { name: 'Conflict', description: 'Item exists or dependency absent' },
500: { name: 'InternalError', description: 'Unexpected internal error' },
502: { name: 'BadGateway', description: 'Bad gateway' },
503: { name: 'Unavailable', description: 'Not available' },
504: { name: 'GatewayTimeout', description: 'Gateway time-out' }
};
function HttpError (code) {

@@ -16,6 +28,5 @@ this.statusCode = code;

if (arguments.length < 2)
WError.call(this, errors[this.statusCode].description);
else {
WError.call(this, httpErrors[this.statusCode].description);
else
WError.apply(this, Array.prototype.slice.call(arguments, 1));
}

@@ -30,19 +41,9 @@ return this;

var errors = {
400: { name: 'BadRequest', description: 'Invalid data was sent to the server' },
401: { name: 'Unauthenticated', description: 'You\'re not authorized to perform such action' },
403: { name: 'Forbidden', description: 'You\'re not allowed to perform such action' },
404: { name: 'NotFound', description: 'Resource was not found' },
409: { name: 'Conflict', description: 'Item exists or dependency absent' },
500: { name: 'InternalError', description: 'Unexpected internal error' },
502: { name: 'BadGateway', description: 'Bad gateway' },
503: { name: 'Unavailable', description: 'Not available' },
504: { name: 'GatewayTimeout', description: 'Gateway time-out' }
}, exports = {};
var errors = {};
Object.keys(errors).forEach(function (errorCode) {
var error = errors[errorCode];
exports[error.name] = new E(+errorCode);
Object.keys(httpErrors).forEach(function (errorCode) {
var error = httpErrors[errorCode];
errors[error.name] = new E(+errorCode);
});
module.exports = exports;
module.exports = exports = errors;
{
"name": "http-verror",
"version": "0.0.1",
"version": "0.0.2",
"description": "A simple tool that provides `verror` functionality extended by usable HTTP error codes for Express.js",
"main": "index.js",
"scripts": {
"test": "mocha",
"coverage": "mocha --require blanket -R html-cov > coverage.html"
"test": "mocha -R list",
"test-cov": "mocha --require blanket -R html-cov > coverage.html"
},

@@ -19,4 +19,11 @@ "keywords": [

"author": "Dr. Evil <dr.evil@krtn.eu>",
"repository": {
"type": "git",
"url": "git://github.com/v12/node-http-verror.git"
},
"homepage": "https://github.com/v12/node-http-verror",
"bugs": "https://github.com/v12/node-http-verror/issues",
"license": "GPLv3",
"dependencies": {
"mocha-lcov-reporter": "0.0.1",
"verror": "^1.6.0"

@@ -23,0 +30,0 @@ },

# http-verror - VError adaptation for usage with Express.js
[![Build Status](https://travis-ci.org/v12/node-http-verror.svg)](https://travis-ci.org/v12/node-http-verror) [![Test Coverage](https://codeclimate.com/github/v12/node-http-verror/badges/coverage.svg)](https://codeclimate.com/github/v12/node-http-verror) [![Dependency Status](https://david-dm.org/v12/node-http-verror.svg)](https://david-dm.org/v12/node-http-verror)
## Installation
```npm install http-verror --save```

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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