From 39ec02d3c4cb5f5980b172d30404210de2479f0f Mon Sep 17 00:00:00 2001 From: marzavec Date: Tue, 13 Mar 2018 22:26:53 -0700 Subject: Streamlined modules, server tweaks, better feedback --- server/src/managers/commands.js | 11 ++++------- server/src/managers/config.js | 6 ++---- 2 files changed, 6 insertions(+), 11 deletions(-) (limited to 'server/src/managers') 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; } -- cgit v1.2.1