client: drop namespaced from VarlinkError.new in _next_varlink_message#82
Merged
jelly merged 3 commits intovarlink:masterfrom Nov 11, 2025
Merged
client: drop namespaced from VarlinkError.new in _next_varlink_message#82jelly merged 3 commits intovarlink:masterfrom
jelly merged 3 commits intovarlink:masterfrom
Conversation
|
Looks good to me. (especially because the fallback VarlinkErrorCase normalize to dictionary) |
jelly
reviewed
Nov 9, 2025
| varlink.InterfaceNotFound("org.varlink.notfound"), | ||
| varlink.MethodNotFound("Method"), | ||
| varlink.MethodNotImplemented("Abstract"), | ||
| varlink.InvalidParameter("Struct.param"), |
Collaborator
There was a problem hiding this comment.
Noticed this doesn't differentiate for namespaced, while that is an accepted argument in VarlinkError.__init__.
Now that isn't something which will happen in practice but its a bit confusing. Also note VarlinkError has parameters() which does have namespaced support.
There was a problem hiding this comment.
Well the goal here was to test the client handling of those errors, not the Errors serialization which is supposed to be the same whether the error is namespaced or not (although that could be an interesting test as well).
The relevant code is in essence the following
decoded = json.loads(message)
if "error" in decoded and decoded["error"] is not None:
raise VarlinkError.new(decoded)
where message is at first an incoming Varlink message that is string-encoded
JSON. This means at this point the thing being handed to VarlinkError.new is a
dictionary. The namespaced keyword being passed in before, would tell
VarlinkError to handle the incoming thing as a SimpleNamespace, thus leading to
breakage.
An alternative at this point might be to instead add an object hook if
namespaced is true, but since the instantiation of the error object will
directly normalise this to a dictionary and the relevant methods on the error
have their own namespace options, this seems gratuitous.
65782fd to
5d6005a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This is an alternative to #66.