Skip to content

Commit

Permalink
Fix more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Melchior committed Aug 24, 2023
1 parent 1dcfc72 commit 1fbfc7b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,11 @@ object CoreErrorConverter {
return userError ?: when {
ErrorCode.RLM_ERR_INDEX_OUT_OF_BOUNDS == errorCode ->
IndexOutOfBoundsException(message)
ErrorCategory.RLM_ERR_CAT_INVALID_ARG in categories ->
ErrorCategory.RLM_ERR_CAT_INVALID_ARG in categories && ErrorCategory.RLM_ERR_CAT_SYNC_ERROR !in categories -> {
// Some sync errors flagged as both logical and illegal. In our case, we consider those
// IllegalState, so discard them them here and let them fall through to the bottom case
IllegalArgumentException(message)
}
ErrorCategory.RLM_ERR_CAT_LOGIC in categories || ErrorCategory.RLM_ERR_CAT_RUNTIME in categories ->
IllegalStateException(message)
else -> Error(message) // This can happen when propagating user level exceptions.
Expand Down
2 changes: 1 addition & 1 deletion packages/external/core
Original file line number Diff line number Diff line change
Expand Up @@ -386,15 +386,9 @@ class SyncedRealmTests {
exception.message.let { errorMessage ->
assertNotNull(errorMessage)
// Some race on JVM in particular mean that different errors can be reported.
if (errorMessage.contains("[Client]")) {
assertTrue(errorMessage.contains("[BadChangeset(112)]"), errorMessage)
assertTrue(errorMessage.contains("Bad changeset (DOWNLOAD)"), errorMessage)
} else if (errorMessage.contains("[Session]")) {
assertTrue(errorMessage.contains("InvalidSchemaChange(225)"), errorMessage)
assertTrue(
errorMessage.contains("Invalid schema change (UPLOAD)"),
errorMessage
)
if (errorMessage.contains("[Sync]")) {
assertTrue(errorMessage.contains("[BadChangeset(1015)]"), errorMessage)
assertTrue(errorMessage.contains("Schema mismatch"), errorMessage)
} else {
fail("Unexpected error message: $errorMessage")
}
Expand Down

0 comments on commit 1fbfc7b

Please sign in to comment.