Skip to content

Commit

Permalink
chore: add detail to ValidationError
Browse files Browse the repository at this point in the history
  • Loading branch information
BobTheBuidler committed Jul 6, 2024
1 parent 92196f6 commit a05b726
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion dank_mids/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,10 @@ def decode_result(self, method: Optional[RPCEndpoint] = None, _caller = None) ->
# NOTE: These must be added to the `RETURN_TYPES` constant above manually
if method and (typ := RETURN_TYPES.get(method)):
if method in ["eth_call", "eth_blockNumber", "eth_getCode", "eth_getBlockByNumber", "eth_getTransactionReceipt", "eth_getTransactionCount", "eth_getBalance", "eth_chainId", "erigon_getHeaderByNumber"]:
return msgspec.json.decode(self.result, type=typ)
try:
return msgspec.json.decode(self.result, type=typ)
except msgspec.ValidationError as e:
raise ValueError(e, f'method: {method} result: {msgspec.json.decode(self.result)}').with_traceback(e.__traceback__)
try:
start = time()
decoded = msgspec.json.decode(self.result, type=typ)
Expand Down

0 comments on commit a05b726

Please sign in to comment.