Skip to content

improve(contract): clearer error messages during call() #1002#3846

Open
dpk-jr wants to merge 1 commit into
ApeWorX:mainfrom
dpk-jr:improve-contract-error-messages
Open

improve(contract): clearer error messages during call() #1002#3846
dpk-jr wants to merge 1 commit into
ApeWorX:mainfrom
dpk-jr:improve-contract-error-messages

Conversation

@dpk-jr
Copy link
Copy Markdown

@dpk-jr dpk-jr commented May 17, 2026

Summary

Improve error messages when contract calls fail during call() operations.

Changes

  • Added _decode_contract_error() function to decode revert/panic errors
  • Support for Error(string) reverts - shows human-readable message
  • Support for Panic(uint256) errors - shows specific panic code meaning
  • Support for unknown custom errors - shows selector
  • Updated both sync and async versions

Before (cryptic error)

Could not decode contract function call to mint with return data: 0x08c379a0...

After (clear error)

execution reverted: Not enough ETH
or
execution reverted: Panic(Arithmetic overflow/underflow)

Related Issue

Fixes #1002

Add better error handling for contract revert/panic errors:
- Decode Error(string) reverts and show human-readable message
- Decode Panic(uint256) errors with specific panic code meanings
- Handle unknown custom errors with selector in message
- Provide clearer error messages instead of cryptic eth-abi exceptions

Fixes ApeWorX#1002
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clearer error on contract execution error during call()

2 participants