Skip to content

Commit

Permalink
Fix wrong SyncError constructor calls
Browse files Browse the repository at this point in the history
  • Loading branch information
clementetb committed Aug 5, 2022
1 parent ba6ea3c commit a92ca9c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1612,7 +1612,8 @@ actual object RealmInterop {
staticCFunction { userData, syncSession, error ->
val syncError: SyncError = error.useContents {
val code = SyncErrorCode(
SyncErrorCodeCategory.of(error_code.category),
// SyncErrorCodeCategory.of(),
error_code.category.value.toInt(),
error_code.value,
error_code.message.safeKString()
)
Expand Down Expand Up @@ -1774,7 +1775,7 @@ actual object RealmInterop {
) {
val completionCallback = safeUserData<SyncSessionTransferCompletionCallback>(userData)
if (error != null) {
val category = SyncErrorCodeCategory.of(error.pointed.category)
val category = error.pointed.category.value.toInt()
val value: Int = error.pointed.value
val message = error.pointed.message.safeKString()
completionCallback.invoke(SyncErrorCode(category, value, message))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,5 @@ actual enum class SyncErrorCodeCategory(actual val description: String, val nati
}
error("Unknown sync error code category: $nativeValue")
}

fun of(nativeValue: realm_sync_error_category): SyncErrorCodeCategory {
for (value in values()) {
if (value.nativeValue == nativeValue) {
return value
}
}
error("Unknown sync error code category: $nativeValue")
}
}
}

0 comments on commit a92ca9c

Please sign in to comment.