Skip to content

feat: Add comprehensive error handling for Web3 transactions (#113)#256

Open
oscarj007 wants to merge 1 commit into
MettaChain:mainfrom
oscarj007:feature/issue-113-web3-error-handling
Open

feat: Add comprehensive error handling for Web3 transactions (#113)#256
oscarj007 wants to merge 1 commit into
MettaChain:mainfrom
oscarj007:feature/issue-113-web3-error-handling

Conversation

@oscarj007
Copy link
Copy Markdown

Closes #113

Description

This PR resolves the issue where raw, unreadable Web3 transaction errors were displayed to the user. It introduces a robust dictionary mapper utility to translate low-level JSON-RPC hex strings and contract reversion flags into clear, helpful, user-friendly feedback.

Implemented Error Mappings

  • 4001: Maps user rejection signatures to a prompt to re-confirm via wallet.
  • -32603: Captures internal node failures and suggests alternative RPC nodes.
  • INSUFFICIENT_FUNDS: Intercepts low ETH/gas levels and alerts the user to fund their wallet.
  • UNPREDICTABLE_GAS_LIMIT: Identifies simulation blocks where a contract will revert.
  • NETWORK_ERROR: Handles broken endpoints or provider connection drops gracefully.

How Has This Been Tested?

Created a local simulation script (test_error.ts) and executed it via ts-node. Verified that both numeric codes and string phrases trigger the intended user display sentence without throwing any runtime exceptions.

Type of Change

  • Improvement (non-breaking change which improves existing functionality)

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 30, 2026

@oscarj007 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

Improvement: Add comprehensive error handling for Web3 transactions

1 participant