diff options
author | marzavec <admin@marzavec.com> | 2019-05-04 16:27:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-04 16:27:58 +0200 |
commit | 67dca7090fb2e599c6cd5937d678fde90890f024 (patch) | |
tree | c33e50687c2803de66c03ecbb0330f0ace7ecf96 /server/src/serverLib | |
parent | Merge pull request #63 from MinusGix/patch-4 (diff) | |
parent | Update MainServer.js (diff) | |
download | hackchat-67dca7090fb2e599c6cd5937d678fde90890f024.tar.gz hackchat-67dca7090fb2e599c6cd5937d678fde90890f024.zip |
Merge pull request #64 from MinusGix/patch-5
Extend logErrDetailed configuration option to errors when calling a hook
Diffstat (limited to '')
-rw-r--r-- | server/src/serverLib/MainServer.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/server/src/serverLib/MainServer.js b/server/src/serverLib/MainServer.js index c7a4bbe..c55b732 100644 --- a/server/src/serverLib/MainServer.js +++ b/server/src/serverLib/MainServer.js @@ -438,9 +438,13 @@ class MainServer extends WsServer { try { payload = hooks[i].run(this.core, this, socket, payload); } catch (err) { - let errText = `Hook failure, '${type}', '${command}': ${err}`; - console.log(errText); - return errText; + let errText = `Hook failure, '${type}', '${command}': `; + if (this.core.config.logErrDetailed === true) { + console.log(errText + err.stack); + } else { + console.log(errText + err.toString()); + } + return errText + err.toString(); } // A hook function may choose to return false to prevent all further processing |