handling the unavailable homeserver error case in the error formatting as this is now possible via full matrix id handling#

This commit is contained in:
Adam Brown 2022-06-09 15:33:46 +01:00
parent 3a97cfcc36
commit f89b9305e8
1 changed files with 4 additions and 0 deletions

View File

@ -20,6 +20,7 @@ import im.vector.app.R
import im.vector.app.core.error.ErrorFormatter import im.vector.app.core.error.ErrorFormatter
import im.vector.app.core.resources.StringProvider import im.vector.app.core.resources.StringProvider
import im.vector.app.features.onboarding.ftueauth.LoginErrorParser.LoginErrorResult import im.vector.app.features.onboarding.ftueauth.LoginErrorParser.LoginErrorResult
import org.matrix.android.sdk.api.failure.isHomeserverUnavailable
import org.matrix.android.sdk.api.failure.isInvalidPassword import org.matrix.android.sdk.api.failure.isInvalidPassword
import org.matrix.android.sdk.api.failure.isInvalidUsername import org.matrix.android.sdk.api.failure.isInvalidUsername
import org.matrix.android.sdk.api.failure.isLoginEmailUnknown import org.matrix.android.sdk.api.failure.isLoginEmailUnknown
@ -40,6 +41,9 @@ class LoginErrorParser @Inject constructor(
throwable.isInvalidPassword() && password.hasSurroundingSpaces() -> { throwable.isInvalidPassword() && password.hasSurroundingSpaces() -> {
LoginErrorResult(throwable, passwordError = stringProvider.getString(R.string.auth_invalid_login_param_space_in_password)) LoginErrorResult(throwable, passwordError = stringProvider.getString(R.string.auth_invalid_login_param_space_in_password))
} }
throwable.isHomeserverUnavailable() -> {
LoginErrorResult(throwable, usernameOrIdError = stringProvider.getString(R.string.login_error_homeserver_not_found))
}
else -> { else -> {
LoginErrorResult(throwable) LoginErrorResult(throwable)
} }