Skip to content

Commit

Permalink
[minor] More contextual errors when middleware(s) error
Browse files Browse the repository at this point in the history
  • Loading branch information
indexzero committed Sep 8, 2011
1 parent 07c8d2e commit 38315f6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/node-http-proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,19 @@ exports.stack = function stack (middlewares, proxy) {
handle = function (req, res) {
var next = function (err) {
if (err) {
console.error(err.stack);
if (res._headerSent) {
res.destroy();
} else {
}
else {
res.statusCode = 500;
res.setHeader('Content-Type', 'text/plain');
res.end('Internal Server Error');
}

console.error("error in middleware layer: %s", err.stack);
return;
}

child(req, res);
}

Expand Down

0 comments on commit 38315f6

Please sign in to comment.