diff --git a/index.js b/index.js index 272d269..bdcee08 100644 --- a/index.js +++ b/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( - "
A server had unexpected exception. Below, the stack trace of the error is shown:
" +
- err.stack.replace(/\r\n/g, "
").replace(/\n/g, "
").replace(/\r/g, "
").replace(/ /g, " ") +
- "
Please contact the developer/administrator of the website.
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) + - "
" - ); - res.end(); - } else { - callServerError(500, "YellowSquare/" + version, err); - } + elseCallback(); //Invoke default error handler } }); } else { diff --git a/mod.info b/mod.info index 79ba1ad..abf35db 100755 --- a/mod.info +++ b/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" }