Skip to content

Commit

Permalink
chore: add debugging details to msgspec.ValidationError
Browse files Browse the repository at this point in the history
  • Loading branch information
BobTheBuidler committed Sep 1, 2024
1 parent af7b8d9 commit 47e170b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion dank_mids/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,11 @@ def decode(self, partial: Literal[True]) -> PartialResponse:...
def decode(self, partial: Literal[False] = False) -> Response:...
def decode(self, partial: bool = False) -> Union[Response, PartialResponse]:
"""Decode the wrapped `msgspec.Raw` object into a `Response` or a `PartialResponse`."""
return msgspec.json.decode(self._raw, type=PartialResponse if partial else Response)
try:
return msgspec.json.decode(self._raw, type=PartialResponse if partial else Response)
except msgspec.ValidationError as e:
e.args = (*e.args, f"decoded: {msgspec.json.decode(self._raw)}")
raise

JSONRPCBatchRequest = List[Request]
# NOTE: A PartialResponse result implies a failure response from the rpc.
Expand Down

0 comments on commit 47e170b

Please sign in to comment.