forked from github/wulkanowy-mirror
Add ConnectException and StreamResetException to known exceptions (#992)
This commit is contained in:
parent
da2346ed83
commit
ca67e144e4
@ -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'
|
||||
|
||||
|
@ -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<DialogErrorBinding>() {
|
||||
errorDialogReport.isEnabled = when (error) {
|
||||
is UnknownHostException,
|
||||
is InterruptedIOException,
|
||||
is ConnectException,
|
||||
is StreamResetException,
|
||||
is SocketTimeoutException,
|
||||
is ServiceUnavailableException,
|
||||
is FeatureDisabledException,
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user