Fix the exception message for refreshing an immutable Realm #5065
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #5061
It may be debatable if calling refresh on an immutable Realm should throw or silently do nothing. We could easily make it a no-op, but it seems that the historical behaviour has been to throw an exception so I'll bring that back to not break other SDKs who may be relying on this.
Tracking down the history led to #4688 being where the first refresh was allowed and did nothing. This was because the first refresh of an immutable Realm had no associated transaction and so populated one there. The second call to refresh, now having a transaction actually tried to advance the version and the DB object throws because it has been configured without history.
☑️ ToDos