aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/managers
diff options
context:
space:
mode:
authormarzavec <admin@marzavec.com>2018-03-14 06:26:53 +0100
committermarzavec <admin@marzavec.com>2018-03-14 06:26:53 +0100
commit39ec02d3c4cb5f5980b172d30404210de2479f0f (patch)
treeb837c9cfff94c62aa3de9880e4f7d07460734984 /server/src/managers
parentstabilized modules and server cmd field (diff)
downloadhackchat-39ec02d3c4cb5f5980b172d30404210de2479f0f.tar.gz
hackchat-39ec02d3c4cb5f5980b172d30404210de2479f0f.zip
Streamlined modules, server tweaks, better feedback
Diffstat (limited to '')
-rw-r--r--server/src/managers/commands.js11
-rw-r--r--server/src/managers/config.js6
2 files changed, 6 insertions, 11 deletions
diff --git a/server/src/managers/commands.js b/server/src/managers/commands.js
index 95d0f1b..569206d 100644
--- a/server/src/managers/commands.js
+++ b/server/src/managers/commands.js
@@ -17,7 +17,7 @@ class CommandManager {
/**
* Create a `CommandManager` instance for handling commands/protocol
*
- * @param {Object} core reference to the global core object
+ * @param {Object} core Reference to the global core object
*/
constructor (core) {
this.core = core;
@@ -57,8 +57,7 @@ class CommandManager {
let error = this._validateCommand(command);
if (error) {
- // TODO: Add to logger?
- let errText = `Failed to load '${name}': ${error}\n\n`;
+ let errText = `Failed to load '${name}': ${error}`;
console.log(errText);
return errText;
}
@@ -82,8 +81,7 @@ class CommandManager {
try {
command.init(this.core);
} catch (err) {
- // TODO: Add to logger?
- let errText = `Failed to initialize '${name}': ${err}\n\n`;
+ let errText = `Failed to initialize '${name}': ${err}`;
console.log(errText);
return errText;
}
@@ -227,8 +225,7 @@ class CommandManager {
try {
return await command.run(this.core, server, socket, data);
} catch (err) {
- // TODO: Add to logger?
- let errText = `Failed to execute '${command.info.name}': ${err}\n\n`;
+ let errText = `Failed to execute '${command.info.name}': ${err}`;
console.log(errText);
server.reply({
diff --git a/server/src/managers/config.js b/server/src/managers/config.js
index 2ff4a88..1848cac 100644
--- a/server/src/managers/config.js
+++ b/server/src/managers/config.js
@@ -202,10 +202,8 @@ class ConfigManager {
fse.removeSync(backupPath);
return true;
- } catch (e) {
- // TODO: restore backup
- // TODO: output to logging engine?
- console.log('Failed to save config file!');
+ } catch (err) {
+ console.log(`Failed to save config file: ${err}`);
return false;
}