From a63f7d0ff74679cbbf118c7f042d4897a5708deb Mon Sep 17 00:00:00 2001 From: Clemente Date: Thu, 11 Jul 2024 10:37:54 +0200 Subject: [PATCH] Suppress deprecation warnings --- .../kotlin/mongodb/exceptions/SyncExceptions.kt | 1 + .../kotlin/mongodb/internal/RealmSyncUtils.kt | 14 ++++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/packages/library-sync/src/commonMain/kotlin/io/realm/kotlin/mongodb/exceptions/SyncExceptions.kt b/packages/library-sync/src/commonMain/kotlin/io/realm/kotlin/mongodb/exceptions/SyncExceptions.kt index 39d88e2e12..5350877d65 100644 --- a/packages/library-sync/src/commonMain/kotlin/io/realm/kotlin/mongodb/exceptions/SyncExceptions.kt +++ b/packages/library-sync/src/commonMain/kotlin/io/realm/kotlin/mongodb/exceptions/SyncExceptions.kt @@ -68,6 +68,7 @@ public open class UnrecoverableSyncException internal constructor(message: Strin * Thrown when the type of sync used by the server does not match the one used by the client, i.e. * the server and client disagrees whether to use Partition-based or Flexible Sync. */ +@Suppress("DEPRECATION") public class WrongSyncTypeException internal constructor(message: String) : UnrecoverableSyncException(message) diff --git a/packages/library-sync/src/commonMain/kotlin/io/realm/kotlin/mongodb/internal/RealmSyncUtils.kt b/packages/library-sync/src/commonMain/kotlin/io/realm/kotlin/mongodb/internal/RealmSyncUtils.kt index 46fbc13e17..a6f015b9fb 100644 --- a/packages/library-sync/src/commonMain/kotlin/io/realm/kotlin/mongodb/internal/RealmSyncUtils.kt +++ b/packages/library-sync/src/commonMain/kotlin/io/realm/kotlin/mongodb/internal/RealmSyncUtils.kt @@ -17,7 +17,6 @@ import io.realm.kotlin.mongodb.exceptions.FunctionExecutionException import io.realm.kotlin.mongodb.exceptions.InvalidCredentialsException import io.realm.kotlin.mongodb.exceptions.ServiceException import io.realm.kotlin.mongodb.exceptions.SyncException -import io.realm.kotlin.mongodb.exceptions.UnrecoverableSyncException import io.realm.kotlin.mongodb.exceptions.UserAlreadyConfirmedException import io.realm.kotlin.mongodb.exceptions.UserAlreadyExistsException import io.realm.kotlin.mongodb.exceptions.UserNotFoundException @@ -91,19 +90,26 @@ internal fun convertSyncError(syncError: SyncError): SyncException { syncError.compensatingWrites, syncError.isFatal ) + ErrorCode.RLM_ERR_SYNC_PROTOCOL_INVARIANT_FAILED, ErrorCode.RLM_ERR_SYNC_PROTOCOL_NEGOTIATION_FAILED, - ErrorCode.RLM_ERR_SYNC_PERMISSION_DENIED -> { + ErrorCode.RLM_ERR_SYNC_PERMISSION_DENIED, + -> { // Permission denied errors should be unrecoverable according to Core, i.e. the // client will disconnect sync and transition to the "inactive" state - UnrecoverableSyncException(message) + @Suppress("DEPRECATION") io.realm.kotlin.mongodb.exceptions.UnrecoverableSyncException( + message + ) } + else -> { // An error happened we are not sure how to handle. Just report as a generic // SyncException. when (syncError.isFatal) { false -> SyncException(message, syncError.isFatal) - true -> UnrecoverableSyncException(message) + true -> @Suppress("DEPRECATION") io.realm.kotlin.mongodb.exceptions.UnrecoverableSyncException( + message + ) } } }