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

client: Include version info and interface name in BindError #682

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

Conversation

MarijnS95
Copy link
Contributor

When BindError is returned (and bubbled up by callers) it is no longer clear what interface or version was requested (nor what is the highest this server might be able to provide), leaving users to wonder what the context for the error is.

Add this information to the object to elaborate in error messages and allow callers to read the values after the fact.


This supersedes #671 by also including the requested version and interface name (in addition to the available version), and a documtation fix.

Note that all of this might be considered redundant as the caller typically knows these values (they passed them as function arguments), and it would be up to them to re-wrap the error with this info as context? Is there a policy for this?

Comment on lines -118 to 119
/// If the lower bound of the `version` is less than the version advertised by the server, then
/// If the lower bound of the `version` is greater than the version advertised by the server, then
/// [`BindError::UnsupportedVersion`] is returned.
Copy link
Contributor Author

@MarijnS95 MarijnS95 Dec 17, 2023

Choose a reason for hiding this comment

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

What I assume happened here is that let version in the code is rebound to what is found in the global registry (i.e. the version that is available), while "the lower bound of the version" is rebound to version_start.

Copy link
Member

@elinorbgr elinorbgr left a comment

Choose a reason for hiding this comment

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

LGTM thanks, but that PR needs a rebase it appears.

When `BindError` is returned (and bubbled up by callers) it is no longer
clear what interface or version was requested (nor what is the highest
this server might be able to provide), leaving users to wonder what the
context for the error is.

Add this information to the object to elaborate in error messages and
allow callers to read the values after the fact.
@MarijnS95
Copy link
Contributor Author

Yup, I was using this on top of wayland-backend-v0.3.2 to test as [patch.crates-io] without running into incompatible changes. Should be good now :)

Copy link

codecov bot commented Dec 19, 2023

Codecov Report

Attention: Patch coverage is 71.42857% with 4 lines in your changes missing coverage. Please review.

Project coverage is 72.97%. Comparing base (7e98c79) to head (068d582).
Report is 79 commits behind head on master.

Files Patch % Lines
wayland-client/src/globals.rs 71.42% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #682      +/-   ##
==========================================
- Coverage   73.00%   72.97%   -0.03%     
==========================================
  Files          48       48              
  Lines        7826     7826              
==========================================
- Hits         5713     5711       -2     
- Misses       2113     2115       +2     
Flag Coverage Δ
main 58.26% <0.00%> (ø)
test-- 78.12% <71.42%> (-0.04%) ⬇️
test--server_system 61.07% <71.42%> (-0.04%) ⬇️
test-client_system- 68.93% <71.42%> (-0.04%) ⬇️
test-client_system-server_system 51.39% <71.42%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

Successfully merging this pull request may close these issues.

3 participants