Skip to content

Commit

Permalink
Use res.message for sending batch file errors.
Browse files Browse the repository at this point in the history
The messenger middleware provides this method.

Dav recently fixed a bug for Chrome by sending
a body for 404 errors. Since this method will also
send a body, the bug should remain fixed.
  • Loading branch information
reid committed Jun 8, 2012
1 parent eefee4d commit 6deffcc
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions lib/hub/batch.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,22 +181,15 @@ Batch.prototype.handleFileRequest = function (server, filename) {
server.res.writeHead(302, {
"Location": agent.nextURL()
});
server.res.end();
} else {
batch.report("agentError", agent, {
message: "Unable to serve the file: " + filename + ", ignoring"
});
server.res.writeHead(404, {
"content-type": "text/plain"
});
server.res.end("Not Found");
server.res.message(404);
}

server.res.end();
} else {
server.res.writeHead(500, {
"content-type": "text/plain"
});
server.res.end("Unable to serve this file.");
server.res.message(500);
}
return;
}
Expand Down

0 comments on commit 6deffcc

Please sign in to comment.