mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
refactor(network): Preserve original exception
This commit is contained in:
parent
195613cb1e
commit
ce9a3ea399
1 changed files with 3 additions and 3 deletions
|
@ -9,6 +9,8 @@ import eu.kanade.tachiyomi.network.AndroidCookieJar
|
||||||
import eu.kanade.tachiyomi.util.system.WebViewClientCompat
|
import eu.kanade.tachiyomi.util.system.WebViewClientCompat
|
||||||
import eu.kanade.tachiyomi.util.system.isOutdated
|
import eu.kanade.tachiyomi.util.system.isOutdated
|
||||||
import eu.kanade.tachiyomi.util.system.toast
|
import eu.kanade.tachiyomi.util.system.toast
|
||||||
|
import java.io.IOException
|
||||||
|
import java.util.concurrent.CountDownLatch
|
||||||
import okhttp3.Cookie
|
import okhttp3.Cookie
|
||||||
import okhttp3.HttpUrl.Companion.toHttpUrl
|
import okhttp3.HttpUrl.Companion.toHttpUrl
|
||||||
import okhttp3.Interceptor
|
import okhttp3.Interceptor
|
||||||
|
@ -16,8 +18,6 @@ import okhttp3.Request
|
||||||
import okhttp3.Response
|
import okhttp3.Response
|
||||||
import yokai.i18n.MR
|
import yokai.i18n.MR
|
||||||
import yokai.util.lang.getString
|
import yokai.util.lang.getString
|
||||||
import java.io.IOException
|
|
||||||
import java.util.concurrent.*
|
|
||||||
|
|
||||||
class CloudflareInterceptor(
|
class CloudflareInterceptor(
|
||||||
private val context: Context,
|
private val context: Context,
|
||||||
|
@ -49,7 +49,7 @@ class CloudflareInterceptor(
|
||||||
// Because OkHttp's enqueue only handles IOExceptions, wrap the exception so that
|
// Because OkHttp's enqueue only handles IOExceptions, wrap the exception so that
|
||||||
// we don't crash the entire app
|
// we don't crash the entire app
|
||||||
catch (e: CloudflareBypassException) {
|
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) {
|
} catch (e: Exception) {
|
||||||
throw IOException(e)
|
throw IOException(e)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue