diff --git a/vector/src/main/java/im/vector/riotx/core/error/ErrorFormatter.kt b/vector/src/main/java/im/vector/riotx/core/error/ErrorFormatter.kt index bb7892e109..8987b0260a 100644 --- a/vector/src/main/java/im/vector/riotx/core/error/ErrorFormatter.kt +++ b/vector/src/main/java/im/vector/riotx/core/error/ErrorFormatter.kt @@ -20,6 +20,7 @@ import im.vector.matrix.android.api.failure.Failure import im.vector.matrix.android.api.failure.MatrixError import im.vector.riotx.R import im.vector.riotx.core.resources.StringProvider +import java.net.SocketTimeoutException import javax.inject.Inject class ErrorFormatter @Inject constructor(val stringProvider: StringProvider) { @@ -33,7 +34,13 @@ class ErrorFormatter @Inject constructor(val stringProvider: StringProvider) { fun toHumanReadable(throwable: Throwable?): String { return when (throwable) { null -> null - is Failure.NetworkConnection -> stringProvider.getString(R.string.error_no_network) + is Failure.NetworkConnection -> { + if (throwable.ioException is SocketTimeoutException) { + stringProvider.getString(R.string.error_network_timeout) + } else { + stringProvider.getString(R.string.error_no_network) + } + } is Failure.ServerError -> { if (throwable.error.code == MatrixError.M_CONSENT_NOT_GIVEN) { // Special case for terms and conditions diff --git a/vector/src/main/res/values/strings_riotX.xml b/vector/src/main/res/values/strings_riotX.xml index e02de69806..f2ac7817be 100644 --- a/vector/src/main/res/values/strings_riotX.xml +++ b/vector/src/main/res/values/strings_riotX.xml @@ -11,5 +11,6 @@ It looks like you’re trying to connect to another homeserver. Do you want to sign out? + Looks like the server is taking to long to respond, this can be caused by either poor connectivity or an error with our servers. Please try again in a while. \ No newline at end of file