mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-03 06:01:40 +00:00
Ensure mapping of Rust exceptions cover all cases.
This commit is contained in:
committed by
Benoit Marty
parent
5b8e99149a
commit
5b44eab444
+11
-7
@@ -14,13 +14,17 @@ import org.matrix.rustcomponents.sdk.RecoveryException as RustRecoveryException
|
|||||||
|
|
||||||
fun Throwable.mapRecoveryException(): RecoveryException {
|
fun Throwable.mapRecoveryException(): RecoveryException {
|
||||||
return when (this) {
|
return when (this) {
|
||||||
is RustRecoveryException.SecretStorage -> RecoveryException.SecretStorage(
|
is RustRecoveryException -> {
|
||||||
message = errorMessage
|
when (this) {
|
||||||
)
|
is RustRecoveryException.SecretStorage -> RecoveryException.SecretStorage(
|
||||||
is RustRecoveryException.BackupExistsOnServer -> RecoveryException.BackupExistsOnServer
|
message = errorMessage
|
||||||
is RustRecoveryException.Client -> RecoveryException.Client(
|
)
|
||||||
source.mapClientException()
|
is RustRecoveryException.BackupExistsOnServer -> RecoveryException.BackupExistsOnServer
|
||||||
)
|
is RustRecoveryException.Client -> RecoveryException.Client(
|
||||||
|
source.mapClientException()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
else -> RecoveryException.Client(
|
else -> RecoveryException.Client(
|
||||||
ClientException.Other("Unknown error")
|
ClientException.Other("Unknown error")
|
||||||
)
|
)
|
||||||
|
|||||||
+5
-1
@@ -12,7 +12,11 @@ import org.matrix.rustcomponents.sdk.ClientException as RustClientException
|
|||||||
|
|
||||||
fun Throwable.mapClientException(): ClientException {
|
fun Throwable.mapClientException(): ClientException {
|
||||||
return when (this) {
|
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")
|
else -> ClientException.Other(message ?: "Unknown error")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user