mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 21:32:34 +00:00
Improve error mapping
This commit is contained in:
+11
-2
@@ -32,8 +32,17 @@ sealed class ChangeServerError : Exception() {
|
||||
companion object {
|
||||
fun from(error: Throwable): ChangeServerError = when (error) {
|
||||
is ChangeServerError -> error
|
||||
is AuthenticationException.SlidingSyncVersion -> SlidingSyncAlert
|
||||
is AuthenticationException.Oidc -> Error(messageStr = error.message)
|
||||
is AuthenticationException -> {
|
||||
when (error) {
|
||||
is AuthenticationException.SlidingSyncVersion -> SlidingSyncAlert
|
||||
is AuthenticationException.InvalidServerName,
|
||||
is AuthenticationException.ServerUnreachable -> InvalidServer
|
||||
// AccountAlreadyLoggedIn error should not happen at this point
|
||||
is AuthenticationException.AccountAlreadyLoggedIn -> Error(messageStr = error.message)
|
||||
is AuthenticationException.Generic -> Error(messageStr = error.message)
|
||||
is AuthenticationException.Oidc -> Error(messageStr = error.message)
|
||||
}
|
||||
}
|
||||
is AccountProviderAccessException.NeedElementProException -> NeedElementPro(
|
||||
unauthorisedAccountProviderTitle = error.unauthorisedAccountProviderTitle,
|
||||
applicationId = error.applicationId,
|
||||
|
||||
Reference in New Issue
Block a user