Update to YellowSquare 1.1.0
This commit is contained in:
parent
6ab5ede805
commit
e67b2f0c06
2 changed files with 10 additions and 28 deletions
34
index.js
34
index.js
|
@ -12,8 +12,13 @@ try {
|
|||
} catch (ex) {
|
||||
// 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 {
|
||||
constructor(sourceStream) {
|
||||
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 {
|
||||
if (!callServerError) {
|
||||
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, " ") +
|
||||
"</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);
|
||||
}
|
||||
elseCallback(); //Invoke default error handler
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
|
4
mod.info
4
mod.info
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
"name": "DorianTech YellowSquare JSGI engine for SVR.JS",
|
||||
"version": "1.0.3"
|
||||
"name": "YellowSquare JSGI engine for SVR.JS",
|
||||
"version": "1.1.0"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue