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

httpexceptions

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

httpexceptions - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

8

index.js

@@ -5,2 +5,3 @@ /// <reference path="typings/node/node.d.ts" />

(function (HTTPException_1) {
var debugEnable = true;
HTTPException_1.HTTPException = require('./lib/http-exception');

@@ -20,2 +21,6 @@ HTTPException_1.BadGateway = require('./lib/types/badgateway');

HTTPException_1.Unauthorized = require('./lib/types/unauthorized');
function debug(b) {
debugEnable = b;
}
HTTPException_1.debug = debug;
/**

@@ -49,2 +54,5 @@ *

.send(err.getMessage());
if (debugEnable) {
throw err;
}
}

@@ -51,0 +59,0 @@ };

@@ -16,2 +16,4 @@ /// <reference path="typings/node/node.d.ts" />

var debugEnable = true;
export var HTTPException = require('./lib/http-exception');

@@ -32,2 +34,5 @@ export var BadGateway = require('./lib/types/badgateway');

export function debug(b:boolean){
debugEnable = b;
}
/**

@@ -70,2 +75,5 @@ *

if(debugEnable){
throw err;
}
}

@@ -72,0 +80,0 @@ }

8

package.json
{
"name": "httpexceptions",
"version": "1.0.0",
"version": "1.0.1",
"description": "Provide exception for HTTP Rest API",

@@ -25,6 +25,4 @@ "main": "index.js",

"homepage": "https://github.com/romakita/httpexceptions",
"dependencies": {
},
"devDependencies":{
"dependencies": {},
"devDependencies": {
"chai": "^2.1.0",

@@ -31,0 +29,0 @@ "grunt": "~0.4.5",

@@ -26,10 +26,37 @@ # HTTPExceptions [![Build Status](https://travis-ci.org/Romakita/httpexceptions.svg?branch=master)](https://travis-ci.org/Romakita/httpexceptions)

Install
---
## Install
Use `npm install http-exceptions`.
Use `npm install httpexceptions`.
Test
---
## API
``` javascript
var httpException = require('httpexception');
var express = require('express');
var app = express();
httpException.debug(true);
app.use(httpException.mime('application/json'));
//or
app.use(httpException.mime(['application/json', 'text/xml']));
app.get('/my/route/exception', function(req, res){
throw new httpException.BadRequest('Custom Message'); //Emit
//or
throw new httpException.HTTPException(510, 'Custom Message');
});
//at the end
//GlobalHandler middleware catch exception and send response to the client
app.use(httpException.globalHandler());
```
## Test
Use `npm test`.

@@ -36,0 +63,0 @@

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