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.
As the CDP changes, messages can become different from the definition. As long as there is no breaking change, this will be fine. Sometimes though those messages will have breaking changes.
In this case we want to be able to handle them properly. Before this change the user had to add clause to handle
CdpError::Serde
. With this change we introduceCdpError::InvalidMessage
. This is already clearer on the intent.I reverted #197 since it is not the job of the connection to decide what to do with those errors. Instead I added a configuration on the handler to avoid those errors from surfacing (instead they are logged). If a user wishes to handle those errors themselves, they can disable that config.
I added a test to ensure that the untagged union problem of serde doesn't affect us.
I also checked the proposal to add a new
CdpEvent
variant to handle those malformed events, but like I mentioned on the PR this is not viable because it would require the user to add a custom event listener for all event ids.Closes #206
Closes #207
Closes #243