Add missing executions of callback in ClientManager.updateUser

Signed-off-by: Howard Johnson <merlin@merlinthp.org>
This commit is contained in:
Howard Johnson 2018-01-13 23:05:23 +00:00
parent b3702b0550
commit 10d43f27ed

View File

@ -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;
}
};