From ce9a3ea399bbdc13e3f1e0e724dc82402de4322a Mon Sep 17 00:00:00 2001 From: Ahmad Ansori Palembani Date: Mon, 26 Aug 2024 07:41:33 +0700 Subject: [PATCH] refactor(network): Preserve original exception --- .../tachiyomi/network/interceptor/CloudflareInterceptor.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/src/androidMain/kotlin/eu/kanade/tachiyomi/network/interceptor/CloudflareInterceptor.kt b/core/src/androidMain/kotlin/eu/kanade/tachiyomi/network/interceptor/CloudflareInterceptor.kt index cc618733b6..ff32e904dd 100644 --- a/core/src/androidMain/kotlin/eu/kanade/tachiyomi/network/interceptor/CloudflareInterceptor.kt +++ b/core/src/androidMain/kotlin/eu/kanade/tachiyomi/network/interceptor/CloudflareInterceptor.kt @@ -9,6 +9,8 @@ import eu.kanade.tachiyomi.network.AndroidCookieJar import eu.kanade.tachiyomi.util.system.WebViewClientCompat import eu.kanade.tachiyomi.util.system.isOutdated import eu.kanade.tachiyomi.util.system.toast +import java.io.IOException +import java.util.concurrent.CountDownLatch import okhttp3.Cookie import okhttp3.HttpUrl.Companion.toHttpUrl import okhttp3.Interceptor @@ -16,8 +18,6 @@ import okhttp3.Request import okhttp3.Response import yokai.i18n.MR import yokai.util.lang.getString -import java.io.IOException -import java.util.concurrent.* class CloudflareInterceptor( private val context: Context, @@ -49,7 +49,7 @@ class CloudflareInterceptor( // Because OkHttp's enqueue only handles IOExceptions, wrap the exception so that // we don't crash the entire app catch (e: CloudflareBypassException) { - throw IOException(context.getString(MR.strings.failed_to_bypass_cloudflare)) + throw IOException(context.getString(MR.strings.failed_to_bypass_cloudflare), e) } catch (e: Exception) { throw IOException(e) }