Skip to content

Commit

Permalink
fix: rewrite errors for eth_call too
Browse files Browse the repository at this point in the history
  • Loading branch information
banteg committed Apr 7, 2021
1 parent b1f752b commit a06a35f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion brownie/network/middlewares/hardhat.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ def process_request(self, make_request: Callable, method: str, params: List) ->
result = make_request(method, params)

# modify Hardhat transaction error to mimick the format that Ganache uses
if method == "eth_sendTransaction" and "error" in result:
if method in ("eth_call", "eth_sendTransaction") and "error" in result:
message = result["error"]["message"]
if message.startswith("VM Exception") or message.startswith("Transaction reverted"):
# FIXME: this doesn't play well with parallel tests
txid = self.w3.eth.getBlock("latest")["transactions"][0]
data: Dict = {}
result["error"]["data"] = {txid.hex(): data}
Expand Down

0 comments on commit a06a35f

Please sign in to comment.