Skip to content

Error Handling

The system provides comprehensive error handling with standardized codes and clear messaging for troubleshooting and debugging.

Custom error class for RPC query failures with context including error code, chain ID, and method information for detailed debugging.

  • 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

Errors return consistent JSON format:

{
"success": false,
"error": {
"message": "Human readable error message",
"code": 1001,
"chainId": 1,
"method": "eth_call"
}
}

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
  1. Check success field in responses
  2. Handle specific error codes appropriately
  3. Implement retry logic for transient errors
  4. Monitor error patterns for system health
  5. Log error context for debugging

The system handles cross-origin requests with proper CORS headers and preflight response support for seamless browser integration.