chore: better error handling for accepting invitation
This commit is contained in:
parent
9dc61bec31
commit
f70995ad05
|
|
@ -204,6 +204,9 @@ impl TestClient {
|
|||
.api_client
|
||||
.accept_workspace_invitation(target_invitation.invite_id.to_string().as_str())
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn try_remove_workspace_member(
|
||||
|
|
|
|||
|
|
@ -286,8 +286,20 @@ pub async fn update_workspace_invitation_set_invited(
|
|||
)
|
||||
.execute(txn.deref_mut())
|
||||
.await?;
|
||||
assert_eq!(res.rows_affected(), 1);
|
||||
Ok(())
|
||||
match res.rows_affected() {
|
||||
0 => Err(AppError::RecordNotFound(format!(
|
||||
"Invitation not found, invitee_uuid: {}, invite_id: {}",
|
||||
invitee_uuid, invite_id
|
||||
))),
|
||||
1 => Ok(()),
|
||||
x => Err(
|
||||
anyhow::anyhow!(
|
||||
"Expected 1 row to be affected, but {} rows were affected",
|
||||
x
|
||||
)
|
||||
.into(),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn get_invitation_by_id(
|
||||
|
|
|
|||
Loading…
Reference in New Issue