forked from svrjs/svrjs
Improve web root error handling
This commit is contained in:
parent
15ca36cf16
commit
2ec6b564f5
2 changed files with 9 additions and 7 deletions
|
@ -3,7 +3,7 @@
|
|||
"port": 80,
|
||||
"pubport": 80,
|
||||
"page404": "404.html",
|
||||
"timestamp": 1694334249412,
|
||||
"timestamp": 1694363783457,
|
||||
"blacklist": [],
|
||||
"nonStandardCodes": [],
|
||||
"enableCompression": true,
|
||||
|
|
12
svr.js
12
svr.js
|
@ -1151,11 +1151,12 @@ if (configJSON.rewriteDirtyURLs != undefined) rewriteDirtyURLs = configJSON.rewr
|
|||
if (configJSON.errorPages != undefined) errorPages = configJSON.errorPages;
|
||||
if (configJSON.useWebRootServerSideScript != undefined) useWebRootServerSideScript = configJSON.useWebRootServerSideScript;
|
||||
if (configJSON.exposeModsInErrorPages != undefined) exposeModsInErrorPages = configJSON.exposeModsInErrorPages;
|
||||
if (configJSON.wwwroot != undefined) {
|
||||
var wwwroot = configJSON.wwwroot;
|
||||
if (cluster.isPrimary || cluster.isPrimary === undefined) process.chdir(wwwroot);
|
||||
} else {
|
||||
if (cluster.isPrimary || cluster.isPrimary === undefined) process.chdir(__dirname);
|
||||
|
||||
var wwwrootError = null;
|
||||
try {
|
||||
if (cluster.isPrimary || cluster.isPrimary === undefined) process.chdir(configJSON.wwwroot != undefined ? configJSON.wwwroot : __dirname);
|
||||
} catch(err) {
|
||||
wwwrootError = err;
|
||||
}
|
||||
|
||||
// Compability for older mods
|
||||
|
@ -4871,6 +4872,7 @@ function start(init) {
|
|||
if (netIPs.indexOf(listenAddress) > -1) throw new Error("SVR.JS can't listen on subnet address.");
|
||||
}
|
||||
if(certificateError) throw new Error("There was a problem with SSL certificate/private key: " + certificateError.message);
|
||||
if(wwwrootError) throw new Error("There was a problem with your web root: " + wwwrootError.message);
|
||||
}
|
||||
|
||||
// Information about starting the server
|
||||
|
|
Reference in a new issue