feat(sdk)!: Merge HttpError::UiaaError into HttpError::Api

This commit is contained in:
Jonas Platte
2022-10-11 19:56:48 +02:00
committed by Jonas Platte
parent f07735291e
commit f4e0cab11f
3 changed files with 32 additions and 20 deletions
+5 -3
View File
@@ -9,7 +9,7 @@ use matrix_sdk_appservice::{
events::room::member::{MembershipState, OriginalSyncRoomMemberEvent},
UserId,
},
HttpError,
HttpError, RumaApiError,
},
ruma::api::{
client::{error::ErrorKind, uiaa::UiaaResponse},
@@ -42,8 +42,10 @@ pub async fn handle_room_member(
pub fn error_if_user_not_in_use(error: matrix_sdk_appservice::Error) -> Result<()> {
match error {
// If user is already in use that's OK.
matrix_sdk_appservice::Error::Matrix(matrix_sdk::Error::Http(HttpError::UiaaError(
FromHttpResponseError::Server(ServerError::Known(UiaaResponse::MatrixError(error))),
matrix_sdk_appservice::Error::Matrix(matrix_sdk::Error::Http(HttpError::Api(
FromHttpResponseError::Server(ServerError::Known(RumaApiError::Uiaa(
UiaaResponse::MatrixError(error),
))),
))) if matches!(error.kind, ErrorKind::UserInUse) => Ok(()),
// In all other cases return with an error.
error => Err(error),