Skip to content

Commit

Permalink
Suppress deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
clementetb committed Jul 11, 2024
1 parent c4f19d5 commit a63f7d0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
)
}
}
}
Expand Down

0 comments on commit a63f7d0

Please sign in to comment.