Skip to content

Commit

Permalink
feat: show trace on failed transactions in Web3Provider (#1949)
Browse files Browse the repository at this point in the history
* feat: show trace on failed transactions in Web3Provider

* docs: update inline comment for clarity
  • Loading branch information
mikeshultz authored Mar 8, 2024
1 parent fedba85 commit 39d7a67
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/ape_ethereum/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -1150,7 +1150,17 @@ def _handle_execution_reverted(
**params,
)
)
return self.compiler_manager.enrich_error(result)
enriched = self.compiler_manager.enrich_error(result)

# Show call trace if availble
if enriched.txn:
# Unlikely scenario where a transaction is on the error even though a receipt exists.
if isinstance(enriched.txn, TransactionAPI) and enriched.txn.receipt:
enriched.txn.receipt.show_trace()
elif isinstance(enriched.txn, ReceiptAPI):
enriched.txn.show_trace()

return enriched


class EthereumNodeProvider(Web3Provider, ABC):
Expand Down

0 comments on commit 39d7a67

Please sign in to comment.