diff --git a/CHANGELOG.md b/CHANGELOG.md index 9dfaacaa..f85c521a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ * Added `triggerImmediately` to `onChange` method. * Report real-time progress information about downloads through `SyncStatus.downloadProgress`. * Compose: Add `composeState()` extension method on `SyncStatus`. +* [Internal] Added helper method for Swift `PowerSyncException` throwing. ## 1.0.0-BETA32 diff --git a/PowerSyncKotlin/src/appleMain/kotlin/com/powersync/SDK.kt b/PowerSyncKotlin/src/appleMain/kotlin/com/powersync/SDK.kt index 05e8dc8d..4a22591c 100644 --- a/PowerSyncKotlin/src/appleMain/kotlin/com/powersync/SDK.kt +++ b/PowerSyncKotlin/src/appleMain/kotlin/com/powersync/SDK.kt @@ -1,5 +1,15 @@ -@file:Suppress("ktlint:standard:no-empty-file") - // This is required to build the iOS framework package com.powersync + +/** + * Helper class designed to bridge SKIEE methods and allow them to throw + * `PowerSyncException`. This is necessary because these exceptions cannot + * be thrown directly in Swift. + * + * The class provides a mechanism to handle exceptions in a way that is + * compatible with the Swift environment, ensuring proper error propagation + * and handling. + */ +@Throws(PowerSyncException::class) +public fun throwPowerSyncException(exception: PowerSyncException): Unit = throw exception