diff --git a/app/src/main/java/eu/kanade/tachiyomi/network/OkHttpExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/network/OkHttpExtensions.kt index 71865f0ea..22e99769a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/network/OkHttpExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/network/OkHttpExtensions.kt @@ -65,7 +65,7 @@ suspend fun Call.await(): Response { object : Callback { override fun onResponse(call: Call, response: Response) { if (!response.isSuccessful) { - continuation.resumeWithException(Exception("HTTP error ${response.code}")) + continuation.resumeWithException(HttpException(response.code)) return } @@ -96,7 +96,7 @@ fun Call.asObservableSuccess(): Observable { return asObservable().doOnNext { response -> if (!response.isSuccessful) { response.close() - throw Exception("HTTP error ${response.code}") + throw HttpException(response.code) } } } @@ -123,3 +123,5 @@ inline fun Response.parseAs(): T { return json.decodeFromString(responseBody) } } + +class HttpException(val code: Int) : IllegalStateException("HTTP error $code") diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt index f5c69beee..66f06fdf4 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt @@ -48,6 +48,7 @@ import eu.kanade.tachiyomi.data.track.EnhancedTrackService import eu.kanade.tachiyomi.data.track.TrackService import eu.kanade.tachiyomi.data.track.model.TrackSearch import eu.kanade.tachiyomi.databinding.MangaControllerBinding +import eu.kanade.tachiyomi.network.HttpException import eu.kanade.tachiyomi.source.LocalSource import eu.kanade.tachiyomi.source.Source import eu.kanade.tachiyomi.source.SourceManager @@ -473,6 +474,12 @@ class MangaController : fun onFetchMangaInfoError(error: Throwable) { isRefreshingInfo = false updateRefreshing() + + // Ignore early hints "errors" that aren't handled by OkHttp + if (error is HttpException && error.code == 103) { + return + } + activity?.toast(error.message) }