From 03ad8eae1ea02c6271dc64186fe2fb0e2ef054bc Mon Sep 17 00:00:00 2001 From: pistomat Date: Wed, 26 Jun 2024 13:52:29 +0200 Subject: [PATCH] Revert on Json RPC error --- src/protocols/EthJsonRPC.sol | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/protocols/EthJsonRPC.sol b/src/protocols/EthJsonRPC.sol index 896b7e3..bf6c1f6 100644 --- a/src/protocols/EthJsonRPC.sol +++ b/src/protocols/EthJsonRPC.sol @@ -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"'); }