Skip to content

Commit a05b726

Browse files
committed
chore: add detail to ValidationError
1 parent 92196f6 commit a05b726

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

dank_mids/types.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,10 @@ def decode_result(self, method: Optional[RPCEndpoint] = None, _caller = None) ->
129129
# NOTE: These must be added to the `RETURN_TYPES` constant above manually
130130
if method and (typ := RETURN_TYPES.get(method)):
131131
if method in ["eth_call", "eth_blockNumber", "eth_getCode", "eth_getBlockByNumber", "eth_getTransactionReceipt", "eth_getTransactionCount", "eth_getBalance", "eth_chainId", "erigon_getHeaderByNumber"]:
132-
return msgspec.json.decode(self.result, type=typ)
132+
try:
133+
return msgspec.json.decode(self.result, type=typ)
134+
except msgspec.ValidationError as e:
135+
raise ValueError(e, f'method: {method} result: {msgspec.json.decode(self.result)}').with_traceback(e.__traceback__)
133136
try:
134137
start = time()
135138
decoded = msgspec.json.decode(self.result, type=typ)

0 commit comments

Comments
 (0)