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

Properly handle invalid messages #246

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Sytten
Copy link
Contributor

@Sytten Sytten commented Oct 24, 2024

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 introduce CdpError::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

@Sytten
Copy link
Contributor Author

Sytten commented Nov 10, 2024

@mattsse sorry to bug you but can you take a look. I dont want the PR to go stale

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.

bug: Chromiumoxide stopped working with the latest version of Chrome
1 participant