Rethrow CancellationException

pull/141/head
Koitharu 4 years ago
parent 1b3af70690
commit 9c9a389aa5
No known key found for this signature in database
GPG Key ID: 8E861F8CE6E7CE27

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

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

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

Loading…
Cancel
Save