diff --git a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/encryption/RecoveryExceptionMapper.kt b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/encryption/RecoveryExceptionMapper.kt index e200ca5434..b33d59375b 100644 --- a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/encryption/RecoveryExceptionMapper.kt +++ b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/encryption/RecoveryExceptionMapper.kt @@ -14,13 +14,17 @@ import org.matrix.rustcomponents.sdk.RecoveryException as RustRecoveryException fun Throwable.mapRecoveryException(): RecoveryException { return when (this) { - is RustRecoveryException.SecretStorage -> RecoveryException.SecretStorage( - message = errorMessage - ) - is RustRecoveryException.BackupExistsOnServer -> RecoveryException.BackupExistsOnServer - is RustRecoveryException.Client -> RecoveryException.Client( - source.mapClientException() - ) + is RustRecoveryException -> { + when (this) { + is RustRecoveryException.SecretStorage -> RecoveryException.SecretStorage( + message = errorMessage + ) + is RustRecoveryException.BackupExistsOnServer -> RecoveryException.BackupExistsOnServer + is RustRecoveryException.Client -> RecoveryException.Client( + source.mapClientException() + ) + } + } else -> RecoveryException.Client( ClientException.Other("Unknown error") ) diff --git a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/exception/ClientException.kt b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/exception/ClientException.kt index c15b873d73..87364930ce 100644 --- a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/exception/ClientException.kt +++ b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/exception/ClientException.kt @@ -12,7 +12,11 @@ import org.matrix.rustcomponents.sdk.ClientException as RustClientException fun Throwable.mapClientException(): ClientException { return when (this) { - is RustClientException.Generic -> ClientException.Generic(msg) + is RustClientException -> { + when (this) { + is RustClientException.Generic -> ClientException.Generic(msg) + } + } else -> ClientException.Other(message ?: "Unknown error") } }