You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When hitting a rate limit on a reth node. Was getting the error: Err(DeserError { err: Error("expected value", line: 1, column: 1). This was very missleading as the message was text: "Too many connections. Please try again later." that comes with a 429 status code. This should be a ErrorResp afaik.
err=Err(DeserError { err: Error("expected value", line: 1, column: 1), text: "Too many connections. Please try again later." })
#[derive(Debug,Clone)]pubstructLocalProvider{provider:Arc<Provider<Http<reqwest::Client>>>,retries:u8,}implLocalProvider{pubfnnew(url:String,retries:u8) -> Self{let http = Http::new(url.parse().unwrap());Self{provider:Arc::new(Provider::new(http)), retries }}}#[async_trait::async_trait]implTracingProviderforLocalProvider{asyncfneth_call(&self,request:TransactionRequest,block_number:Option<BlockId>,state_overrides:Option<StateOverride>,block_overrides:Option<Box<BlockOverrides>>,) -> eyre::Result<Bytes>{if state_overrides.is_some() || block_overrides.is_some(){panic!("local provider doesn't support block or state overrides");}// for tests, shit can get beefy letmut attempts = 0;loop{let inner = self.provider.inner();let res_str:String = inner
.prepare("eth_call",(request.clone(), block_number)).await.unwrap();let res = self.provider.call(request.clone(), block_number).await;if res.is_ok() || attempts > self.retries{return res.map_err(Into::into)}else{// error message was generated here
tracing::error!(eth_call_error=%res_str, ?request, err=?res);}
attempts += 1}}}
The text was updated successfully, but these errors were encountered:
This should not be an ErrResp as ErrResp must conform to the JSON-RPC2.0 spec. This should be an Error::custom. Which can be achieved for reqwest using error_for_status, and as a custom error in the hyper transport
Component
network, json-rpc, rpc
What version of Alloy are you on?
rev 76c70fb
Operating System
Linux
Describe the bug
When hitting a rate limit on a reth node. Was getting the error: Err(DeserError { err: Error("expected value", line: 1, column: 1). This was very missleading as the message was
text: "Too many connections. Please try again later."
that comes with a 429 status code. This should be a ErrorResp afaik.The text was updated successfully, but these errors were encountered: