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.11 to 1.1.0

30

index.js
/// <reference path="type.d.ts" />
var HTTPException;
(function (HTTPException_1) {
var debugEnable = true;
HTTPException_1.HTTPException = require('./lib/http-exception');

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

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

@@ -62,3 +57,3 @@ *

if (a.length) {
throw new HTTPException_1.BadRequest(a);
throw new HTTPException_1.BadRequest('Parameters required ' + a.join(', ') + '.');
}

@@ -70,27 +65,4 @@ };

HTTPException_1.paramsRequired = paramsRequired;
/**
*
* @returns {function(any, Express.Request, Express.Response): undefined}
*/
function globalHandler() {
return function (err, req, res) {
if (err instanceof HTTPException_1.HTTPException) {
try {
res.status(err.status)
.send(err.getMessage());
}
catch (er) {
console.log('unable to run getMessage() method');
res.status(err.status)
.send(err.message);
}
if (debugEnable) {
throw err;
}
}
};
}
HTTPException_1.globalHandler = globalHandler;
})(HTTPException || (HTTPException = {}));
module.exports = HTTPException;
//# sourceMappingURL=index.js.map

@@ -11,4 +11,2 @@ /// <reference path="type.d.ts" />

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

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

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

@@ -83,3 +78,3 @@ *

if(a.length){
throw new BadRequest(a);
throw new BadRequest('Parameters required ' + a.join(', ') +'.');
}

@@ -92,28 +87,2 @@ };

/**
*
* @returns {function(any, Express.Request, Express.Response): undefined}
*/
export function globalHandler(){
return function(err:any, req:Express.Request, res:Express.Response){
if (err instanceof HTTPException) {
try{
res.status(err.status)
.send(err.getMessage());
}catch(er){
console.log('unable to run getMessage() method');
res.status(err.status)
.send(err.message);
}
if(debugEnable){
throw err;
}
}
}
}
}

@@ -120,0 +89,0 @@

2

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

@@ -5,0 +5,0 @@ "main": "index.js",

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