Skip to content

Conversation

@behrmann
Copy link
Collaborator

@behrmann behrmann commented Nov 8, 2025

This is an alternative to #66.

@Mocramis
Copy link

Mocramis commented Nov 8, 2025

Looks good to me. (especially because the fallback VarlinkErrorCase normalize to dictionary)

varlink.InterfaceNotFound("org.varlink.notfound"),
varlink.MethodNotFound("Method"),
varlink.MethodNotImplemented("Abstract"),
varlink.InvalidParameter("Struct.param"),
Copy link
Collaborator

Choose a reason for hiding this comment

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

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.

Choose a reason for hiding this comment

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

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).

Copy link
Collaborator

@jelly jelly left a comment

Choose a reason for hiding this comment

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

Thanks!

Rémy Noel and others added 3 commits November 10, 2025 22:40
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.
@jelly jelly merged commit 8b3ba4e into varlink:master Nov 11, 2025
8 checks passed
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.

3 participants