diff options
author | MinusGix <MinusGix@gmail.com> | 2019-04-28 00:04:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-28 00:04:07 +0200 |
commit | e592b29137981435ac15a37388dabde2db11c01c (patch) | |
tree | 7905daf0cc9d9519e812e1c7f9ae51eb794ade72 | |
parent | Update CommandManager.js (diff) | |
download | hackchat-e592b29137981435ac15a37388dabde2db11c01c.tar.gz hackchat-e592b29137981435ac15a37388dabde2db11c01c.zip |
Update CommandManager.js
-rw-r--r-- | server/src/serverLib/CommandManager.js | 12 |
1 files changed, 11 insertions, 1 deletions
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', |