Skip to content
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

Ignore unknown events in the client, at deserialization. #9471

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AureliaDolo
Copy link
Contributor

Fix #9410

The added test case fails with BadContent without the patch.

@AureliaDolo AureliaDolo marked this pull request as ready for review January 30, 2025 15:06
@AureliaDolo AureliaDolo requested a review from a team as a code owner January 30, 2025 15:06
@AureliaDolo AureliaDolo force-pushed the aurelia/ignore_unknown_events branch from 246118a to dbf6acb Compare January 30, 2025 15:10
@AureliaDolo AureliaDolo force-pushed the aurelia/ignore_unknown_events branch from dbf6acb to 2481da7 Compare January 30, 2025 15:49
Copy link
Contributor

@vxgmichel vxgmichel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of minor comments, LGTM otherwise 👍

match T::api_load_response(raw.as_ref()) {
Ok(cooked) => SSEResponseOrMissedEvents::Response(cooked),
Err(e) => {
log::trace!("Invalid event data: {e}");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use a log::warn!() since it's a useful information to know?

Ok(cooked) => SSEResponseOrMissedEvents::Response(cooked),
Err(e) => {
log::trace!("Invalid event data: {e}");
// we ignore bad deserialization
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain in this comment that ignoring a bad deserialization error is useful to not break compatibility when new event types are added to our protocol?

Also comments should start with a capitalized letter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ignore unkown events in the client
3 participants