diff options
author | Harsh Shandilya <me@msfjarvis.dev> | 2022-07-23 03:15:29 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-22 21:45:29 +0000 |
commit | 6d0bff144c35c9f2c73f34065e972b3f48a34241 (patch) | |
tree | 674da15806a0f97641cb90ac3dcc0e96dfe6bcf5 /coroutine-utils | |
parent | 9a3c18234883d10fb2391e7bad6c06ff4f16f9b3 (diff) |
Begin cleaning up Detekt warnings (#2027)
Diffstat (limited to 'coroutine-utils')
-rw-r--r-- | coroutine-utils/src/main/kotlin/app/passwordstore/util/coroutines/RunSuspendCatching.kt | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/coroutine-utils/src/main/kotlin/app/passwordstore/util/coroutines/RunSuspendCatching.kt b/coroutine-utils/src/main/kotlin/app/passwordstore/util/coroutines/RunSuspendCatching.kt index c650c14b..677c2bc3 100644 --- a/coroutine-utils/src/main/kotlin/app/passwordstore/util/coroutines/RunSuspendCatching.kt +++ b/coroutine-utils/src/main/kotlin/app/passwordstore/util/coroutines/RunSuspendCatching.kt @@ -22,8 +22,9 @@ public suspend inline fun <V> runSuspendCatching(block: () -> V): Result<V, Thro return try { Ok(block()) + } catch (e: CancellationException) { + throw e } catch (e: Throwable) { - if (e is CancellationException) throw e Err(e) } } @@ -42,8 +43,9 @@ public suspend inline infix fun <T, V> T.runSuspendCatching( return try { Ok(block()) + } catch (e: CancellationException) { + throw e } catch (e: Throwable) { - if (e is CancellationException) throw e Err(e) } } |