Merge pull request #1978 from merlinthp/chpass_callback

Add missing execution of callback in ClientManager.updateUser
This commit is contained in:
Jérémie Astori 2018-01-13 18:47:01 -05:00 committed by GitHub
commit 42199eda29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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