mod_admin_shell: user:create(): Reject promise with error message on failure

This commit is contained in:
Matthew Wild 2025-01-07 19:24:05 +00:00
parent f40e997879
commit 54de66e7b0

View file

@ -1728,7 +1728,7 @@ function def_env.user:create(jid, password, role)
return promise.resolve(password or self.session.request_input("password")):next(function (password_)
local ok, err = um.create_user_with_role(username, password_, host, role);
if not ok then
return nil, "Could not create user: "..err;
return promise.reject("Could not create user: "..err);
end
return ("Created %s with role '%s'"):format(jid, role);
end);