Update to YellowSquare 1.1.0

This commit is contained in:
Dorian Niemiec 2023-12-31 21:44:50 +01:00
parent 6ab5ede805
commit e67b2f0c06
2 changed files with 10 additions and 28 deletions

View file

@ -12,8 +12,13 @@ try {
} catch (ex) { } catch (ex) {
// Can't determine version // Can't determine version
} }
var configJSONS = JSON.parse(fs.readFileSync(__dirname + "/../../../config.json")); // Read configuration JSON var configJSONS = {};
try {
configJSONS = JSON.parse(fs.readFileSync(__dirname + "/../../../config.json")); // Read configuration JSON
} catch(ex) {
//YellowSquare will not care about configJSONS in SVR.JS 3.x and newer
//SVR.JS 2.x and older will fail to start with broken configuration file anyway...
}
class RequestBodyStream extends stream.Readable { class RequestBodyStream extends stream.Readable {
constructor(sourceStream) { constructor(sourceStream) {
super(); super();
@ -324,31 +329,8 @@ Mod.prototype.callback = function (req, res, serverconsole, responseEnd, href, e
} }
} }
}); });
} else if (err && err.code == "ENOENT") {
elseCallback(); //Invoke default error handler
} else { } else {
if (!callServerError) { elseCallback(); //Invoke default error handler
res.writeHead(500, "Internal Server Error", abheaders);
res.write(
"<html><head><title>500 Internal Server Error</title></head><body><h1>500 Internal Server Error</h1><p>A server had unexpected exception. Below, the stack trace of the error is shown:</p><code>" +
err.stack.replace(/\r\n/g, "<br/>").replace(/\n/g, "<br/>").replace(/\r/g, "<br/>").replace(/ /g, "&nbsp;") +
"</code><p>Please contact the developer/administrator of the website.</p><p style=\"font-style: italic; font-weight: normal;\">SVR.JS " +
configJSON.version +
" (" +
os.platform()[0].toUpperCase() +
os.platform().slice(1) +
"; Node.JS/" +
process.version +
") YellowSquare/" +
version +
" " +
(req.headers.host == undefined ? "" : " on " + req.headers.host) +
"</p></body></html>"
);
res.end();
} else {
callServerError(500, "YellowSquare/" + version, err);
}
} }
}); });
} else { } else {

View file

@ -1,4 +1,4 @@
{ {
"name": "DorianTech YellowSquare JSGI engine for SVR.JS", "name": "YellowSquare JSGI engine for SVR.JS",
"version": "1.0.3" "version": "1.1.0"
} }