Skip to content

Commit

Permalink
fix: bug
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey committed Oct 26, 2024
1 parent a24374b commit ccf51d1
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/ape_ethereum/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
from ape.api.trace import TraceAPI
from ape.api.transactions import ReceiptAPI, TransactionAPI
from ape.exceptions import (
_SOURCE_TRACEBACK_ARG,
_TRACE_ARG,
ApeException,
APINotImplementedError,
BlockNotFoundError,
Expand Down Expand Up @@ -1245,9 +1247,9 @@ def _handle_execution_reverted(
self,
exception: Union[Exception, str],
txn: Optional[TransactionAPI] = None,
trace: Optional[TraceAPI] = None,
trace: _TRACE_ARG = None,
contract_address: Optional[AddressType] = None,
source_traceback: Optional[SourceTraceback] = None,
source_traceback: _SOURCE_TRACEBACK_ARG = None,
set_ape_traceback: Optional[bool] = None,
) -> ContractLogicError:
if hasattr(exception, "args") and len(exception.args) == 2:
Expand Down Expand Up @@ -1277,10 +1279,13 @@ def _handle_execution_reverted(
if trace is None and txn is not None:
trace = self.provider.get_transaction_trace(to_hex(txn.txn_hash))

if trace is not None and (revert_message := trace.revert_message):
message = revert_message
no_reason = False
if revert_message := trace.revert_message:
if trace is not None:
if callable(trace):
trace_called = params["trace"] = trace()
else:
trace_called = trace

if trace_called is not None and (revert_message := trace_called.revert_message):
message = revert_message
no_reason = False

Expand Down

0 comments on commit ccf51d1

Please sign in to comment.