Skip to content

Commit 0c78802

Browse files
fix: Don't catch CancellationException (#122)
Co-authored-by: Dominic Gunther Bauer <[email protected]>
1 parent e15540a commit 0c78802

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

core/src/commonMain/kotlin/com/powersync/db/Functions.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package com.powersync.db
22

33
import co.touchlab.kermit.Logger
44
import com.powersync.PowerSyncException
5+
import kotlinx.coroutines.CancellationException
56

67
public fun <R> runWrapped(block: () -> R): R =
78
try {
@@ -20,6 +21,10 @@ public suspend fun <R> runWrappedSuspending(block: suspend () -> R): R =
2021
try {
2122
block()
2223
} catch (t: Throwable) {
24+
if (t is CancellationException) {
25+
throw t
26+
}
27+
2328
if (t is PowerSyncException) {
2429
Logger.e("PowerSyncException: ${t.message}")
2530
throw t

0 commit comments

Comments
 (0)