Skip to main contentRobust error handling is crucial for any production-ready application. Our ShardeumAPI class incorporates try...catch blocks around all network and wallet interactions.
Common Error Scenarios
- Wallet Not Found: Prompt user to install MetaMask or another wallet extension.
- Wallet Connection Rejected: User declined wallet connection; show a clear message.
- Transaction Rejected by User: User declined to sign the transaction; handle gracefully.
- RPC Errors: Inspect the
error object in the RPC response for details.
- Network Errors: Catch and display network issues (e.g., endpoint down, no internet).
By handling these cases, your app will be more resilient and user-friendly.