From ca67e144e41cccc9f6176a589f9fbef4f0a96448 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Pich?= Date: Tue, 13 Oct 2020 22:32:15 +0200 Subject: [PATCH] Add ConnectException and StreamResetException to known exceptions (#992) --- app/build.gradle | 2 +- app/src/main/java/io/github/wulkanowy/ui/base/ErrorDialog.kt | 4 ++++ .../main/java/io/github/wulkanowy/utils/ResourcesExtension.kt | 4 +++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index a83aa0eb7..903a3128c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -127,7 +127,7 @@ configurations.all { } dependencies { - implementation "io.github.wulkanowy:sdk:0.21.2" + implementation "io.github.wulkanowy:sdk:4d7e031" coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.0.10' diff --git a/app/src/main/java/io/github/wulkanowy/ui/base/ErrorDialog.kt b/app/src/main/java/io/github/wulkanowy/ui/base/ErrorDialog.kt index 8d6739a15..341ae4590 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/base/ErrorDialog.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/base/ErrorDialog.kt @@ -22,9 +22,11 @@ import io.github.wulkanowy.utils.getString import io.github.wulkanowy.utils.openAppInMarket import io.github.wulkanowy.utils.openEmailClient import io.github.wulkanowy.utils.openInternetBrowser +import okhttp3.internal.http2.StreamResetException import java.io.InterruptedIOException import java.io.PrintWriter import java.io.StringWriter +import java.net.ConnectException import java.net.SocketTimeoutException import java.net.UnknownHostException import javax.inject.Inject @@ -85,6 +87,8 @@ class ErrorDialog : BaseDialogFragment() { errorDialogReport.isEnabled = when (error) { is UnknownHostException, is InterruptedIOException, + is ConnectException, + is StreamResetException, is SocketTimeoutException, is ServiceUnavailableException, is FeatureDisabledException, diff --git a/app/src/main/java/io/github/wulkanowy/utils/ResourcesExtension.kt b/app/src/main/java/io/github/wulkanowy/utils/ResourcesExtension.kt index de9f656a2..b7956eb9c 100644 --- a/app/src/main/java/io/github/wulkanowy/utils/ResourcesExtension.kt +++ b/app/src/main/java/io/github/wulkanowy/utils/ResourcesExtension.kt @@ -7,13 +7,15 @@ import io.github.wulkanowy.sdk.scrapper.exception.FeatureDisabledException import io.github.wulkanowy.sdk.scrapper.exception.ServiceUnavailableException import io.github.wulkanowy.sdk.scrapper.login.NotLoggedInException import io.github.wulkanowy.sdk.scrapper.login.PasswordChangeRequiredException +import okhttp3.internal.http2.StreamResetException import java.io.InterruptedIOException +import java.net.ConnectException import java.net.SocketTimeoutException import java.net.UnknownHostException fun Resources.getString(error: Throwable) = when (error) { is UnknownHostException -> getString(R.string.error_no_internet) - is SocketTimeoutException, is InterruptedIOException -> getString(R.string.error_timeout) + is SocketTimeoutException, is InterruptedIOException, is ConnectException, is StreamResetException -> getString(R.string.error_timeout) is NotLoggedInException -> getString(R.string.error_login_failed) is PasswordChangeRequiredException -> getString(R.string.error_password_change_required) is ServiceUnavailableException -> getString(R.string.error_service_unavailable)