Commit 38315f6b authored by indexzero's avatar indexzero

[minor] More contextual errors when middleware(s) error

parent 07c8d2ee
...@@ -125,16 +125,19 @@ exports.stack = function stack (middlewares, proxy) { ...@@ -125,16 +125,19 @@ exports.stack = function stack (middlewares, proxy) {
handle = function (req, res) { handle = function (req, res) {
var next = function (err) { var next = function (err) {
if (err) { if (err) {
console.error(err.stack);
if (res._headerSent) { if (res._headerSent) {
res.destroy(); res.destroy();
} else { }
else {
res.statusCode = 500; res.statusCode = 500;
res.setHeader('Content-Type', 'text/plain'); res.setHeader('Content-Type', 'text/plain');
res.end('Internal Server Error'); res.end('Internal Server Error');
} }
console.error("error in middleware layer: %s", err.stack);
return; return;
} }
child(req, res); child(req, res);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment