From 81de6124f056b307d25f73e2888acc80854ee02b Mon Sep 17 00:00:00 2001 From: Koitharu Date: Sat, 9 Sep 2023 17:42:00 +0300 Subject: [PATCH] Rethrow CancellationException from TrackWorkers #489 --- .../kotlin/org/koitharu/kotatsu/tracker/work/TrackWorker.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/tracker/work/TrackWorker.kt b/app/src/main/kotlin/org/koitharu/kotatsu/tracker/work/TrackWorker.kt index 08511fc30..406dbdcb7 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/tracker/work/TrackWorker.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/tracker/work/TrackWorker.kt @@ -34,6 +34,7 @@ import coil.request.ImageRequest import dagger.Reusable import dagger.assisted.Assisted import dagger.assisted.AssistedInject +import kotlinx.coroutines.CancellationException import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.NonCancellable import kotlinx.coroutines.flow.Flow @@ -84,6 +85,8 @@ class TrackWorker @AssistedInject constructor( logger.log("doWork(): attempt $runAttemptCount") return try { doWorkImpl() + } catch (e: CancellationException) { + throw e } catch (e: Throwable) { logger.log("fatal", e) Result.failure()