Error Handling
Error Handling
Section titled “Error Handling”The system provides comprehensive error handling with standardized codes and clear messaging for troubleshooting and debugging.
Error Types
Section titled “Error Types”RpcQueryError
Section titled “RpcQueryError”Custom error class for RPC query failures with context including error code, chain ID, and method information for detailed debugging.
Standardized Error Codes
Section titled “Standardized Error Codes”- INVALID_CHAIN: Chain ID not supported or inactive
- FORBIDDEN_METHOD: Method not allowed (transaction methods blocked)
- PROVIDER_ERROR: All providers failed or unavailable
- RATE_LIMIT: Request rate limit exceeded
- VALIDATION_ERROR: Invalid request parameters
- TIMEOUT: Request timeout exceeded
Error Response Format
Section titled “Error Response Format”Errors return consistent JSON format:
{ "success": false, "error": { "message": "Human readable error message", "code": 1001, "chainId": 1, "method": "eth_call" }}HTTP Status Mapping
Section titled “HTTP Status Mapping”Error codes map to appropriate HTTP status codes:
- 400: Invalid request or forbidden method
- 404: Chain not found
- 429: Rate limit exceeded
- 500: Provider or system errors
- 503: All providers unavailable
Error Handling Best Practices
Section titled “Error Handling Best Practices”- Check
successfield in responses - Handle specific error codes appropriately
- Implement retry logic for transient errors
- Monitor error patterns for system health
- Log error context for debugging
CORS and Preflight
Section titled “CORS and Preflight”The system handles cross-origin requests with proper CORS headers and preflight response support for seamless browser integration.