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

express-error-handler

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-error-handler - npm Package Compare versions

Comparing version 0.5.2 to 0.5.3

16

error-handler.js

@@ -190,3 +190,6 @@ /**

renderDefault = function
renderDefault(status) {
renderDefault(statusCode) {
res.statusCode = statusCode;
if (defaultView) {

@@ -202,4 +205,5 @@ return res.render(defaultView, err);

var body = mixIn({}, err, {
status: status,
message: statusCodes[status]
status: statusCode,
message: err.message ||
statusCodes[statusCode]
});

@@ -210,9 +214,9 @@ body = (o.serializer) ?

res.send(status, body);
res.send(statusCode, body);
},
text: function () {
res.send(status);
res.send(statusCode);
},
html: function () {
res.send(status);
res.send(statusCode);
}

@@ -219,0 +223,0 @@ });

{
"name": "express-error-handler",
"version": "0.5.2",
"version": "0.5.3",
"description": "A graceful error handler for Express applications.",

@@ -5,0 +5,0 @@ "main": "error-handler.js",

@@ -315,3 +315,3 @@ 'use strict';

'res.send() should be called ' +
'error message on response body.');
'with error message on response body.');
t.end();

@@ -325,2 +325,28 @@ },

test('JSON with custom error message',
function (t) {
var shutdown = function shutdown() {},
e = new Error(),
handler = createHandler({
shutdown: shutdown
});
e.status = 420;
e.message = 'half baked';
handler(e, testReq(), {
send: function send(status, obj) {
t.equal(obj.message, 'half baked',
'res.send() should be called ' +
'with custom error message.');
t.end();
},
format: function format (types) {
return types['json']();
}
}, testNext);
});
test('JSON with serializer',

@@ -327,0 +353,0 @@ function (t) {

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