At least in the Alchemy JSON RPC API over HTTP, rate limit errors are returned as HTTP 429. Currently these errors are converted to Error::Transport(String) and it's not possible to cleanly access the status code. Moreover, Error::Transport also means errors like failure to deserialize, whose handling will be completely different than handling of capacity limits or rate limit.
This PR changes representations of the errors returned in execute_rpc to rpc::error::Error. Since the HTTP error codes aren't any of the variants defined by jsonrpc-core, the error code will be ErrorCode::ServerError(i64).
At least in the Alchemy JSON RPC API over HTTP, rate limit errors are returned as HTTP 429. Currently these errors are converted to Error::Transport(String) and it's not possible to cleanly access the status code. Moreover,
Error::Transport
also means errors like failure to deserialize, whose handling will be completely different than handling of capacity limits or rate limit.This PR changes representations of the errors returned in
execute_rpc
torpc::error::Error
. Since the HTTP error codes aren't any of the variants defined by jsonrpc-core, the error code will beErrorCode::ServerError(i64)
.cf. https://docs.alchemy.com/alchemy/documentation/error-reference