chore: better error handling for accepting invitation
This commit is contained in:
parent
9dc61bec31
commit
f70995ad05
|
|
@ -204,6 +204,9 @@ impl TestClient {
|
||||||
.api_client
|
.api_client
|
||||||
.accept_workspace_invitation(target_invitation.invite_id.to_string().as_str())
|
.accept_workspace_invitation(target_invitation.invite_id.to_string().as_str())
|
||||||
.await
|
.await
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn try_remove_workspace_member(
|
pub async fn try_remove_workspace_member(
|
||||||
|
|
|
||||||
|
|
@ -286,8 +286,20 @@ pub async fn update_workspace_invitation_set_invited(
|
||||||
)
|
)
|
||||||
.execute(txn.deref_mut())
|
.execute(txn.deref_mut())
|
||||||
.await?;
|
.await?;
|
||||||
assert_eq!(res.rows_affected(), 1);
|
match res.rows_affected() {
|
||||||
Ok(())
|
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(
|
pub async fn get_invitation_by_id(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue