From 10d43f27edbdecb31dc3db3266e97f58ba49246f Mon Sep 17 00:00:00 2001 From: Howard Johnson Date: Sat, 13 Jan 2018 23:05:23 +0000 Subject: [PATCH] Add missing executions of callback in ClientManager.updateUser Signed-off-by: Howard Johnson --- src/clientManager.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/clientManager.js b/src/clientManager.js index c5fda846..8a657b2e 100644 --- a/src/clientManager.js +++ b/src/clientManager.js @@ -136,6 +136,9 @@ ClientManager.prototype.updateUser = function(name, opts, callback) { if (!user) { log.error(`Tried to update invalid user ${colors.green(name)}. This is most likely a bug.`); + if (callback) { + callback(true); + } return false; } @@ -150,8 +153,12 @@ ClientManager.prototype.updateUser = function(name, opts, callback) { try { fs.writeFileSync(Helper.getUserConfigPath(name), newUser); + return callback ? callback() : true; } catch (e) { log.error(`Failed to update user ${colors.green(name)} (${e})`); + if (callback) { + callback(e); + } throw e; } };