classify_rpc_failure

Documentation for eth_defi.provider.rpc_failure.classify_rpc_failure function.

classify_rpc_failure(error)

Classify an upstream JSON-RPC failure into a RpcFailureMode.

Inspection order: concrete requests timeout/connection types first (the most reliable signal), then the normalised HTTP status code, then message substrings. Falls back to RpcFailureMode.unknown when nothing matches — the label is only ever set when there is positive evidence.

Parameters

error (Union[BaseException, dict, str]) – A raised exception, a JSON-RPC error dictionary, or an error string.

Returns

The best-effort failure mode.

Return type

eth_defi.provider.rpc_failure.RpcFailureMode