fix: network safety

This commit is contained in:
rebelonion 2024-05-01 19:45:37 -05:00
parent f03af6856a
commit e32bfa0cfa
7 changed files with 47 additions and 28 deletions

View file

@ -40,7 +40,12 @@ class MangaUpdates {
e.printStackTrace()
}
}
val res = client.post(apiUrl, json = query).parsed<MangaUpdatesResponse>()
val res = try {
client.post(apiUrl, json = query).parsed<MangaUpdatesResponse>()
} catch (e: Exception) {
Logger.log(e.toString())
return@tryWithSuspend null
}
coroutineScope {
res.results?.map {
async(Dispatchers.IO) {