Skip to content

Commit

Permalink
Convert TransactionFailed into SolidityError
Browse files Browse the repository at this point in the history
In an effort to be backend-agnostic eth-tester changes errors that are
specific to one EVM (like Revert) to a TransactionFailed error. This is
useful when using only eth-tester. But as web3.py also works directly
with other eth clients, we have to abstract over the different revert
behaviors ourselves.
  • Loading branch information
karlb committed Mar 3, 2020
1 parent efb92f6 commit ed8dc7d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion web3/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@
from eth_utils.toolz import (
pipe,
)
import eth_tester

from web3._utils.decorators import (
deprecated_for,
)
from web3.exceptions import SolidityError
from web3._utils.threads import ( # noqa: F401
ThreadWithReturn,
spawn,
Expand Down Expand Up @@ -146,7 +148,10 @@ def request_blocking(
"""
Make a synchronous request using the provider
"""
response = self._make_request(method, params)
try:
response = self._make_request(method, params)
except eth_tester.exceptions.TransactionFailed as e:
raise SolidityError(*e.args)

if "error" in response:
response = apply_error_formatters(error_formatters, response)
Expand Down

0 comments on commit ed8dc7d

Please sign in to comment.