chore(reader): Adjust error handler

This commit is contained in:
Ahmad Ansori Palembani 2024-11-20 08:02:53 +07:00
parent dbdafafba7
commit 76de509ae5
Signed by: null2264
GPG key ID: BA64F8B60AF3EFB6

View file

@ -40,6 +40,7 @@ import eu.kanade.tachiyomi.widget.ViewPagerAdapter
import java.io.InputStream import java.io.InputStream
import kotlin.math.min import kotlin.math.min
import kotlin.math.roundToInt import kotlin.math.roundToInt
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Dispatchers.Default import kotlinx.coroutines.Dispatchers.Default
import kotlinx.coroutines.Job import kotlinx.coroutines.Job
@ -502,8 +503,15 @@ class PagerPageHolder(
} }
} }
} }
} catch (e: Exception) { } catch (e: Throwable) {
Logger.e(e) { "Failed to set reader page image" } val logMsg = "Failed to set reader page image"
if (e is CancellationException)
Logger.w(e) { logMsg } // probably user exiting the reader page before the image loads
else
Logger.e(e) { logMsg }
withUIContext {
setError()
}
} }
} }