1
0
Fork 0
forked from svrjs/svrjs

Lint out the codebase

This commit is contained in:
Dorian Niemiec 2024-08-25 16:25:25 +02:00
parent 44e4c15b30
commit 984c94cd00

View file

@ -521,7 +521,9 @@ if (cluster.isPrimary || cluster.isPrimary === undefined) {
function crashHandlerMaster(err) { function crashHandlerMaster(err) {
serverconsole.locerrmessage("SVR.JS worker just crashed!!!"); serverconsole.locerrmessage("SVR.JS worker just crashed!!!");
serverconsole.locerrmessage("Stack:"); serverconsole.locerrmessage("Stack:");
serverconsole.locerrmessage(err.stack ? generateErrorStack(err) : String(err)); serverconsole.locerrmessage(
err.stack ? generateErrorStack(err) : String(err),
);
process.exit(err.errno); process.exit(err.errno);
} }
@ -535,7 +537,10 @@ if (cluster.isPrimary || cluster.isPrimary === undefined) {
saveConfig(); saveConfig();
}*/ }*/
} catch (err) { } catch (err) {
serverconsole.locwarnmessage("There was a problem while saving configuration file. Reason: " + err.message); serverconsole.locwarnmessage(
"There was a problem while saving configuration file. Reason: " +
err.message,
);
} }
try { try {
deleteFolderRecursive(process.dirname + "/temp"); deleteFolderRecursive(process.dirname + "/temp");
@ -547,9 +552,16 @@ if (cluster.isPrimary || cluster.isPrimary === undefined) {
} catch (err) { } catch (err) {
// Error! // Error!
} }
if (process.isBun && process.versions.bun && process.versions.bun[0] == "0") { if (
process.isBun &&
process.versions.bun &&
process.versions.bun[0] == "0"
) {
try { try {
fs.writeFileSync(process.dirname + "/temp/serverSideScript.js", "// Placeholder server-side JavaScript to workaround Bun bug.\r\n"); fs.writeFileSync(
process.dirname + "/temp/serverSideScript.js",
"// Placeholder server-side JavaScript to workaround Bun bug.\r\n",
);
} catch (err) { } catch (err) {
// Error! // Error!
} }
@ -564,7 +576,6 @@ if (cluster.isPrimary || cluster.isPrimary === undefined) {
} }
}); });
process.on("SIGINT", function () { process.on("SIGINT", function () {
reallyExiting = true;
if (cluster.isPrimary !== undefined) { if (cluster.isPrimary !== undefined) {
exiting = true; exiting = true;
// TODO: commands // TODO: commands
@ -587,7 +598,9 @@ if (cluster.isPrimary || cluster.isPrimary === undefined) {
function crashHandler(err) { function crashHandler(err) {
serverconsole.locerrmessage("SVR.JS worker just crashed!!!"); serverconsole.locerrmessage("SVR.JS worker just crashed!!!");
serverconsole.locerrmessage("Stack:"); serverconsole.locerrmessage("Stack:");
serverconsole.locerrmessage(err.stack ? generateErrorStack(err) : String(err)); serverconsole.locerrmessage(
err.stack ? generateErrorStack(err) : String(err),
);
process.exit(err.errno); process.exit(err.errno);
} }
@ -602,4 +615,4 @@ if (cluster.isPrimary || cluster.isPrimary === undefined) {
serverconsole.locwarnmessage(generateErrorStack(warning)); serverconsole.locwarnmessage(generateErrorStack(warning));
} }
}); });
} }