Rethrow CancellationException

This commit is contained in:
Koitharu
2022-04-14 08:07:57 +03:00
parent 1b3af70690
commit 9c9a389aa5
3 changed files with 5 additions and 3 deletions

View File

@@ -141,8 +141,9 @@ class DownloadManager(
}
val localManga = localMangaRepository.getFromFile(output.file)
outState.value = DownloadState.Done(startId, data, cover, localManga)
} catch (_: CancellationException) {
} catch (e: CancellationException) {
outState.value = DownloadState.Cancelled(startId, manga, cover)
throw e
} catch (e: Throwable) {
if (BuildConfig.DEBUG) {
e.printStackTrace()

View File

@@ -143,7 +143,8 @@ class ReaderViewModel(
val page = getCurrentPage() ?: error("Page not found")
externalStorageHelper.savePage(page, destination)
onPageSaved.postCall(destination)
} catch (_: CancellationException) {
} catch (e: CancellationException) {
throw e
} catch (e: Exception) {
if (BuildConfig.DEBUG) {
e.printStackTrace()

View File

@@ -109,7 +109,7 @@ class PageHolderDelegate(
state = State.LOADED
callback.onImageReady(file.toUri())
} catch (e: CancellationException) {
// do nothing
throw e
} catch (e: Exception) {
state = State.ERROR
error = e