express-error-handler
Advanced tools
Comparing version 0.5.2 to 0.5.3
@@ -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) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27167
766