default_failure_handler
Documentation for eth_defi.provider.rpc_proxy.default_failure_handler function.
- default_failure_handler(http_status, json_body)
Default failure detection replicating
eth_defi.middlewarelogic.Adapted from
eth_defi.middleware.is_retryable_http_exception()andeth_defi.provider.fallback.FallbackProviderto work at the HTTP proxy level with raw status codes and JSON bodies rather than Python exceptions.The checks are, in order:
HTTP status code against
eth_defi.middleware.DEFAULT_RETRYABLE_HTTP_STATUS_CODESJSON-RPC
error.codeagainsteth_defi.middleware.DEFAULT_RETRYABLE_RPC_ERROR_CODESJSON-RPC
error.messagesubstring match againsteth_defi.middleware.DEFAULT_RETRYABLE_RPC_ERROR_MESSAGES
Connection-level failures (timeouts, refused connections) are always retried and never reach this handler — they are caught earlier in
_ProxyRequestHandler._try_upstream().