Better error handling
This commit is contained in:
parent
fdc38e3538
commit
8a0c164232
2 changed files with 4 additions and 3 deletions
5
index.js
5
index.js
|
@ -149,14 +149,15 @@ Mod.prototype.callback = function (req, res, serverconsole, responseEnd, href, e
|
|||
socket.write(envEncoded.length + ":" + envEncoded + ",");
|
||||
req.pipe(socket, {end: false});
|
||||
}).on("error", function (error) {
|
||||
var errorcode = (error.code == "ENOTFOUND" || error.code == "EHOSTUNREACH" || error.code == "ECONNREFUSED") ? 503 : 500;
|
||||
if (!callServerError) {
|
||||
res.writeHead(500, {
|
||||
res.writeHead(errorcode, {
|
||||
"Content-Type": "text/html",
|
||||
"Server": "OrangeCircle/" + version
|
||||
});
|
||||
res.end("<html><head></head><body><h1>OrangeCircle Error!</h1><p>Reason: " + error.message + "</p></body></html>");
|
||||
} else {
|
||||
callServerError(500, "OrangeCircle/" + version, error);
|
||||
callServerError(errorcode, "OrangeCircle/" + version, error);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
2
mod.info
2
mod.info
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
"name": "DorianTech OrangeCircle SCGI client for SVR.JS",
|
||||
"version": "1.0.0"
|
||||
"version": "1.0.1"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue