Better error handling

This commit is contained in:
Dorian Niemiec 2023-08-12 12:18:52 +02:00
parent fdc38e3538
commit 8a0c164232
2 changed files with 4 additions and 3 deletions

View file

@ -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);
}
});

View file

@ -1,4 +1,4 @@
{
"name": "DorianTech OrangeCircle SCGI client for SVR.JS",
"version": "1.0.0"
"version": "1.0.1"
}