Comico: Replace `Error` with `Exception` (#7672)

replace error with exception
This commit is contained in:
bapeey 2025-02-17 07:25:19 -05:00 committed by Draff
parent 936331464b
commit 165c752b5b
No known key found for this signature in database
GPG Key ID: E8A89F3211677653
2 changed files with 4 additions and 3 deletions

View File

@ -1,7 +1,7 @@
ext { ext {
extName = 'Comico' extName = 'Comico'
extClass = '.ComicoFactory' extClass = '.ComicoFactory'
extVersionCode = 5 extVersionCode = 6
isNsfw = true isNsfw = true
} }

View File

@ -24,6 +24,7 @@ import okhttp3.Headers
import okhttp3.HttpUrl import okhttp3.HttpUrl
import okhttp3.Response import okhttp3.Response
import uy.kohesive.injekt.injectLazy import uy.kohesive.injekt.injectLazy
import java.lang.Exception
import java.security.MessageDigest import java.security.MessageDigest
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.Calendar import java.util.Calendar
@ -159,7 +160,7 @@ open class Comico(
if (!chapter.name.endsWith(LOCK)) { if (!chapter.name.endsWith(LOCK)) {
super.fetchPageList(chapter) super.fetchPageList(chapter)
} else { } else {
throw Error("You are not authorized to view this!") throw Exception("You are not authorized to view this!")
} }
private fun search(query: String, page: Int) = private fun search(query: String, page: Int) =
@ -176,7 +177,7 @@ open class Comico(
private val Response.data: JsonElement? private val Response.data: JsonElement?
get() = json.parseToJsonElement(body.string()).jsonObject.also { get() = json.parseToJsonElement(body.string()).jsonObject.also {
val code = it["result"]["code"].jsonPrimitive.int val code = it["result"]["code"].jsonPrimitive.int
if (code != 200) throw Error(status(code)) if (code != 200) throw Exception(status(code))
}["data"] }["data"]
private operator fun JsonElement?.get(key: String) = private operator fun JsonElement?.get(key: String) =