-
Notifications
You must be signed in to change notification settings - Fork 165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add missing protocol errors #7982
base: master
Are you sure you want to change the base?
Conversation
@@ -393,6 +393,8 @@ static const constexpr MapElem string_to_error_code[] = { | |||
{"SyncConnectFailed", ErrorCodes::SyncConnectFailed}, | |||
{"SyncConnectTimeout", ErrorCodes::SyncConnectTimeout}, | |||
{"SyncInvalidSchemaChange", ErrorCodes::SyncInvalidSchemaChange}, | |||
{"SyncLocalClockBeforeEpoch", ErrorCodes::SyncLocalClockBeforeEpoch}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was never added to the string_to_error_code
array.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't the new errors be added to this map? and also assign error categories?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am reusing existing ErrorCode values and the two added to this list were already assigned error categories (they were just left off this list - I just verified the list and the only other one missing is UnknownError
this seems to be intentional).
src/realm/sync/protocol.cpp
Outdated
@@ -247,6 +260,8 @@ Status protocol_error_to_status(ProtocolError error_code, std::string_view msg) | |||
case ProtocolError::user_blacklisted: | |||
[[fallthrough]]; | |||
case ProtocolError::transact_before_upload: | |||
[[fallthrough]]; | |||
case ProtocolError::edge_reboot: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is very clearly not unreachable as we reach this point if the server sends us this error code. "Unreachable" specifically means that it's a bug in our code if things ever get to that point.
@@ -393,6 +393,8 @@ static const constexpr MapElem string_to_error_code[] = { | |||
{"SyncConnectFailed", ErrorCodes::SyncConnectFailed}, | |||
{"SyncConnectTimeout", ErrorCodes::SyncConnectTimeout}, | |||
{"SyncInvalidSchemaChange", ErrorCodes::SyncInvalidSchemaChange}, | |||
{"SyncLocalClockBeforeEpoch", ErrorCodes::SyncLocalClockBeforeEpoch}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does this error even mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's an error I added. We use 2015-01-01 as epoch and count the milliseconds since then for the changesets' timestamp. This error is thrown when the local clock is set before that date.
src/realm/error_codes.h
Outdated
// Error code 299 is reserved as an "unknown session error" in tests | ||
} realm_sync_errno_session_e; | ||
|
||
// These errors are intended for the edge server and are an error if received by a sync client | ||
typedef enum realm_sync_errno_edge_e { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should expose errors for the edge server. The only way we could get these is via a bug. I think getting an UnkownError for edge server only errors would be totally acceptable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the edge server and wire protocol errors
Pull Request Test Coverage Report for Build michael.wilkersonbarker_1333Details
💛 - Coveralls |
What, How & Why?
While creating PR #7981, it was discovered that there were 3 protocol errors defined in baas that were not supported in the client. Added definitions for these 3 errors so they will not display "unknown error".
One of these errors (
ProtocolError::edge_reboot
) is only intended for the edge server and an assertion will be thrown by the client when it tries to convert this error to a status object.☑️ ToDos
[ ] 🚦 Tests (or not relevant)[ ] C-API, if public C++ API changed[ ]bindgen/spec.yml
, if public C++ API changed