Skip to content

Commit d0a9832

Browse files
committed
operations: expected Err type to be Error not CisClientError
Refactored for readbility while I was at it. Jira: IAM-1908
1 parent e71322c commit d0a9832

1 file changed

Lines changed: 10 additions & 14 deletions

File tree

src/cis/operations.rs

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,24 +50,20 @@ pub async fn _send_groups_to_cis(
5050
let mut update_profile = Profile::default();
5151
update_profile.access_information.mozilliansorg = profile.access_information.mozilliansorg;
5252
update_profile.active = profile.active;
53-
match update_groups_and_sign(
53+
update_groups_and_sign(
5454
&mut update_profile.access_information.mozilliansorg,
5555
groups,
5656
cis_client.get_secret_store(),
5757
now,
58-
) {
59-
Ok(_) => {
60-
if let Some(user_id) = profile.user_id.value.clone() {
61-
cis_client
62-
.update_user(&user_id, update_profile)
63-
.map_ok(|_| ())
64-
.await
65-
} else {
66-
Err(format_err!("invalid user_id"))
67-
}
68-
}
69-
Err(e) => Err(e),
70-
}
58+
)?;
59+
let Some(user_id) = profile.user_id.value.clone() else {
60+
return Err(format_err!("invalid user_id"));
61+
};
62+
cis_client
63+
.update_user(&user_id, update_profile)
64+
.await
65+
.map(|_| ())
66+
.map_err(Error::from)
7167
}
7268

7369
pub async fn send_groups_to_cis(

0 commit comments

Comments
 (0)