Comico: Replace `Error` with `Exception` (#7672)
replace error with exception
This commit is contained in:
parent
936331464b
commit
165c752b5b
|
@ -1,7 +1,7 @@
|
||||||
ext {
|
ext {
|
||||||
extName = 'Comico'
|
extName = 'Comico'
|
||||||
extClass = '.ComicoFactory'
|
extClass = '.ComicoFactory'
|
||||||
extVersionCode = 5
|
extVersionCode = 6
|
||||||
isNsfw = true
|
isNsfw = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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) =
|
||||||
|
|
Loading…
Reference in New Issue