mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 12:07:28 +00:00
Improve error mapping
This commit is contained in:
+1
-1
@@ -19,7 +19,7 @@ fun Throwable.mapAuthenticationException(): AuthenticationException {
|
||||
is ClientBuildException.InvalidServerName -> AuthenticationException.InvalidServerName(message)
|
||||
is ClientBuildException.SlidingSyncVersion -> AuthenticationException.SlidingSyncVersion(message)
|
||||
is ClientBuildException.Sdk -> AuthenticationException.Generic(message)
|
||||
is ClientBuildException.ServerUnreachable -> AuthenticationException.Generic(message)
|
||||
is ClientBuildException.ServerUnreachable -> AuthenticationException.ServerUnreachable(message)
|
||||
is ClientBuildException.SlidingSync -> AuthenticationException.Generic(message)
|
||||
is ClientBuildException.WellKnownDeserializationException -> AuthenticationException.Generic(message)
|
||||
is ClientBuildException.WellKnownLookupFailed -> AuthenticationException.Generic(message)
|
||||
|
||||
+3
-3
@@ -16,10 +16,10 @@ import org.matrix.rustcomponents.sdk.OidcException
|
||||
|
||||
class AuthenticationExceptionMappingTest {
|
||||
@Test
|
||||
fun `mapping an exception with no message returns 'Unknown error' message`() {
|
||||
fun `mapping an exception with no message returns null message`() {
|
||||
val exception = Exception()
|
||||
val mappedException = exception.mapAuthenticationException()
|
||||
assertThat(mappedException.message).isEqualTo("Unknown error")
|
||||
assertThat(mappedException.message).isEqualTo(null)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -46,7 +46,7 @@ class AuthenticationExceptionMappingTest {
|
||||
assertThat(ClientBuildException.Sdk("SDK issue").mapAuthenticationException())
|
||||
.isException<AuthenticationException.Generic>("SDK issue")
|
||||
assertThat(ClientBuildException.ServerUnreachable("Server unreachable").mapAuthenticationException())
|
||||
.isException<AuthenticationException.Generic>("Server unreachable")
|
||||
.isException<AuthenticationException.ServerUnreachable>("Server unreachable")
|
||||
assertThat(ClientBuildException.SlidingSync("Sliding Sync").mapAuthenticationException())
|
||||
.isException<AuthenticationException.Generic>("Sliding Sync")
|
||||
assertThat(ClientBuildException.WellKnownDeserializationException("WellKnown Deserialization").mapAuthenticationException())
|
||||
|
||||
Reference in New Issue
Block a user