diff --git a/contrib/msggen/msggen/gen/rust.py b/contrib/msggen/msggen/gen/rust.py index a304830c7ec9..3847566bce01 100644 --- a/contrib/msggen/msggen/gen/rust.py +++ b/contrib/msggen/msggen/gen/rust.py @@ -75,7 +75,7 @@ def gen_field(field): elif isinstance(field, PrimitiveField): return gen_primitive(field) else: - raise ValueError(f"Unmanaged type {field}") + raise TypeError(f"Unmanaged type {field}") def gen_enum(e): diff --git a/contrib/pyln-client/pyln/client/gossmap.py b/contrib/pyln-client/pyln/client/gossmap.py index b7a27bcfadfb..876b255a3c51 100755 --- a/contrib/pyln-client/pyln/client/gossmap.py +++ b/contrib/pyln-client/pyln/client/gossmap.py @@ -152,7 +152,7 @@ def __eq__(self, other): def __lt__(self, other): if not isinstance(other, GossmapNodeId): - raise ValueError(f"Cannot compare GossmapNodeId with {type(other)}") + raise TypeError(f"Cannot compare GossmapNodeId with {type(other)}") return self.nodeid.__lt__(other.nodeid) # yes, that works def __hash__(self): @@ -268,7 +268,7 @@ def __eq__(self, other): def __lt__(self, other): if not isinstance(other, GossmapNode): - raise ValueError(f"Cannot compare GossmapNode with {type(other)}") + raise TypeError(f"Cannot compare GossmapNode with {type(other)}") return self.node_id.__lt__(other.node_id) def __hash__(self): diff --git a/contrib/pyln-client/pyln/client/lightning.py b/contrib/pyln-client/pyln/client/lightning.py index e515aaf413d3..3b95adb2596c 100644 --- a/contrib/pyln-client/pyln/client/lightning.py +++ b/contrib/pyln-client/pyln/client/lightning.py @@ -411,7 +411,7 @@ def call(self, method, payload=None, cmdprefix=None, filter=None): sock.close() if not isinstance(resp, dict): - raise ValueError("Malformed response, response is not a dictionary %s." % resp) + raise TypeError("Malformed response, response is not a dictionary %s." % resp) elif "error" in resp: raise RpcError(method, payload, resp['error']) elif "result" not in resp: diff --git a/contrib/pyln-client/pyln/client/plugin.py b/contrib/pyln-client/pyln/client/plugin.py index b96aab746701..28327b602c49 100644 --- a/contrib/pyln-client/pyln/client/plugin.py +++ b/contrib/pyln-client/pyln/client/plugin.py @@ -949,14 +949,14 @@ def _init(self, options: Dict[str, JSONType], def verify_str(d: Dict[str, JSONType], key: str) -> str: v = d.get(key) if not isinstance(v, str): - raise ValueError("Wrong argument to init: expected {key} to be" + raise TypeError("Wrong argument to init: expected {key} to be" " a string, got {v}".format(key=key, v=v)) return v def verify_bool(d: Dict[str, JSONType], key: str) -> bool: v = d.get(key) if not isinstance(v, bool): - raise ValueError("Wrong argument to init: expected {key} to be" + raise TypeError("Wrong argument to init: expected {key} to be" " a bool, got {v}".format(key=key, v=v)) return v diff --git a/contrib/pyln-proto/pyln/proto/primitives.py b/contrib/pyln-proto/pyln/proto/primitives.py index 1de342f3f0ca..3524a25690ed 100644 --- a/contrib/pyln-proto/pyln/proto/primitives.py +++ b/contrib/pyln-proto/pyln/proto/primitives.py @@ -135,7 +135,7 @@ def __init__(self, innerkey): ) elif not isinstance(innerkey, coincurve.keys.PublicKey): - raise ValueError( + raise TypeError( "Key must either be bytes or coincurve.keys.PublicKey" ) self.key = innerkey