realm-core icon indicating copy to clipboard operation
realm-core copied to clipboard

Make sync client use action sent by server with json_error

Open danieltabacaru opened this issue 3 years ago • 2 comments

What, How & Why?

As part of the json_error message the server sends to the client, action is used to indicate which action, if any, the client should take (i.e, client reset). The sync client now stores and uses the action sent by the server.

This PR also removes the logic around which action the client should take based on the error received (since this is now specified by the server).

This represents part 1 of error handling v2.

☑️ ToDos

  • [ ] 📝 Changelog update
  • [x] 🚦 Tests (or not relevant)
  • [x] C-API, if public C++ API changed.

danieltabacaru avatar Jul 28 '22 14:07 danieltabacaru

Should we expose the new Action enum to the C API? Also are there any tests we could write for this?

jbreams avatar Jul 29 '22 13:07 jbreams

Should we expose the new Action enum to the C API? Also are there any tests we could write for this?

I guess we should expose it such that the user could make use of it (i.e, if we really want users know, for example, that they should upgrade the SDK in case of ApplicationBug). At the same time, we don't seem to expose all errors to the user. For that reason, a user will never be able to receive all possible actions, which I find wrong. I think we should expose all errors with their actions to the user, which in turn will simplify the code.

Also, I will think of adding more tests.

danieltabacaru avatar Jul 29 '22 16:07 danieltabacaru