diff --git a/veilid-python/veilid/error.py b/veilid-python/veilid/error.py index dfd7ff9a..17459fcd 100644 --- a/veilid-python/veilid/error.py +++ b/veilid-python/veilid/error.py @@ -13,6 +13,10 @@ class VeilidAPIError(Exception): def __init__(self, *args, **kwargs): super().__init__(self.label, *args, **kwargs) + def __str__(self) -> str: + args = [('label', self.label)] + sorted(vars(self).items()) + return " ".join(f"{key}={value!r}" for (key, value) in args) + @classmethod def from_json(cls, json: dict) -> Self: kind = json["kind"] diff --git a/veilid-python/veilid/types.py b/veilid-python/veilid/types.py index f2d254ec..a9a80587 100644 --- a/veilid-python/veilid/types.py +++ b/veilid-python/veilid/types.py @@ -351,6 +351,9 @@ class DHTRecordDescriptor: self.owner_secret = owner_secret self.schema = schema + def __repr__(self) -> str: + return f"<{self.__class__.__name__}(key={self.key!r})>" + @classmethod def from_json(cls, j: dict) -> Self: return cls( @@ -375,6 +378,9 @@ class ValueData: self.data = data self.writer = writer + def __repr__(self) -> str: + return f"<{self.__class__.__name__}(seq={self.seq!r}, data={self.data!r}, writer={self.writer!r})>" + def __lt__(self, other): if other is None: return True