From 4559de1babffa7c88b9fefe725fc1200c176e3e5 Mon Sep 17 00:00:00 2001 From: MinusGix Date: Fri, 26 Apr 2019 15:18:42 -0500 Subject: Update CommandManager.js --- server/src/serverLib/CommandManager.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/src/serverLib/CommandManager.js b/server/src/serverLib/CommandManager.js index a99d0a9..683d940 100644 --- a/server/src/serverLib/CommandManager.js +++ b/server/src/serverLib/CommandManager.js @@ -268,13 +268,13 @@ class CommandManager { try { return await command.run(this.core, server, socket, data); } catch (err) { - let errText = `Failed to execute '${command.info.name}': ${err}`; - console.log(errText); + let errText = `Failed to execute '${command.info.name}': `; + console.log(errText + err.stack); this.handleCommand(server, socket, { cmd: 'socketreply', cmdKey: server.cmdKey, - text: errText + text: errText + err.toString() }); return null; -- cgit v1.2.1 From e592b29137981435ac15a37388dabde2db11c01c Mon Sep 17 00:00:00 2001 From: MinusGix Date: Sat, 27 Apr 2019 17:04:07 -0500 Subject: Update CommandManager.js --- server/src/serverLib/CommandManager.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/server/src/serverLib/CommandManager.js b/server/src/serverLib/CommandManager.js index 683d940..0c4f0aa 100644 --- a/server/src/serverLib/CommandManager.js +++ b/server/src/serverLib/CommandManager.js @@ -23,6 +23,9 @@ class CommandManager { this.core = core; this.commands = []; this.categories = []; + if (!this.core.config.hasOwnProperty('logErrDetailed')) { + this.core.config.logErrDetailed = false; + } } /** @@ -269,7 +272,14 @@ class CommandManager { return await command.run(this.core, server, socket, data); } catch (err) { let errText = `Failed to execute '${command.info.name}': `; - console.log(errText + err.stack); + + // If we have more detail enabled, then we get the trace + // if it isn't, or the property doesn't exist, then we'll get only the message + if (this.core.config.logErrDetailed === true) { + console.log(errText + err.stack); + } else { + console.log(errText + err.toString()) + } this.handleCommand(server, socket, { cmd: 'socketreply', -- cgit v1.2.1 From 0dd8836e40cf3c2339f5b58002408d5cbcfdc819 Mon Sep 17 00:00:00 2001 From: MinusGix Date: Sat, 27 Apr 2019 17:05:58 -0500 Subject: Update SetupWizard.js --- server/src/scripts/configLib/SetupWizard.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/server/src/scripts/configLib/SetupWizard.js b/server/src/scripts/configLib/SetupWizard.js index 339878d..bd6ef24 100644 --- a/server/src/scripts/configLib/SetupWizard.js +++ b/server/src/scripts/configLib/SetupWizard.js @@ -87,6 +87,12 @@ class SetupWizard { if (typeof result.mods === 'undefined') { result.mods = []; } + + // If we should log errors with the err stack when they occur. + // See: CommandManager.js + if (typeof result.logErrDetailed === 'undefined') { + result.logErrDetailed = false; + } // finally create the actual JSON file try { -- cgit v1.2.1