Skip to content

Commit

Permalink
Revert on Json RPC error
Browse files Browse the repository at this point in the history
  • Loading branch information
pistomat authored Jun 26, 2024
1 parent a750801 commit 03ad8ea
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/protocols/EthJsonRPC.sol
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ contract EthJsonRPC {
bytes memory output = Suave.doHTTPRequest(request);

JSONParserLib.Item memory item = string(output).parse();
JSONParserLib.Item memory err = item.at('"error"');
if (!err.isUndefined()) {
revert(err.value());
}
return item.at('"result"');
}

Expand Down

0 comments on commit 03ad8ea

Please sign in to comment.