Skip to content

Commit 87cf310

Browse files
authored
fix(rpc): Always set data on JSONRPCError, even if None (#2301)
1 parent bf1eda4 commit 87cf310

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/ethereum_test_rpc/rpc_types.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,11 @@ def __init__(self, code: int | str, message: str, data: str | None = None) -> No
4040
"""Initialize the JSONRPCError."""
4141
self.code = int(code)
4242
self.message = message
43-
if data:
44-
self.data = data
43+
self.data = data
4544

4645
def __str__(self) -> str:
4746
"""Return string representation of the JSONRPCError."""
48-
if self.data:
47+
if self.data is not None:
4948
return f"JSONRPCError(code={self.code}, message={self.message}, data={self.data})"
5049

5150
return f"JSONRPCError(code={self.code}, message={self.message})"

0 commit comments

Comments
 (0)