diff --git a/app/src/main/java/ani/dantotsu/connections/comments/CommentsAPI.kt b/app/src/main/java/ani/dantotsu/connections/comments/CommentsAPI.kt index d740d05af82..30e8ddc8a47 100644 --- a/app/src/main/java/ani/dantotsu/connections/comments/CommentsAPI.kt +++ b/app/src/main/java/ani/dantotsu/connections/comments/CommentsAPI.kt @@ -17,6 +17,7 @@ import kotlinx.serialization.encoding.Decoder import kotlinx.serialization.encoding.Encoder import kotlinx.serialization.json.Json import okhttp3.FormBody +import okio.IOException import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get @@ -159,7 +160,12 @@ object CommentsAPI { .add("token", token) .build() val request = requestBuilder() - val json = request.post(url, requestBody = body) + val json = try { + request.post(url, requestBody = body) + } catch (e: IOException) { + snackString("Failed to login to comments API") + return + } if (!json.text.startsWith("{")) return val parsed = try { Json.decodeFromString(json.text) diff --git a/app/src/main/java/eu/kanade/tachiyomi/network/NetworkHelper.kt b/app/src/main/java/eu/kanade/tachiyomi/network/NetworkHelper.kt index a4fe08b4ad6..8ae4a8fdb58 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/network/NetworkHelper.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/network/NetworkHelper.kt @@ -34,8 +34,8 @@ class NetworkHelper( maxSize = 5L * 1024 * 1024, // 5 MiB ), ) - .addInterceptor(BrotliInterceptor) .addInterceptor(UncaughtExceptionInterceptor()) + .addInterceptor(BrotliInterceptor) .addInterceptor(UserAgentInterceptor(::defaultUserAgentProvider)) if (PrefManager.getVal(PrefName.VerboseLogging)) {