mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-09 04:39:24 +00:00
Have simple-request return an error upon failing to find the system's root certificates
This commit is contained in:
@@ -62,7 +62,8 @@ impl Rpc {
|
||||
/// provided to this library, if the RPC has an incompatible argument layout. That is not checked
|
||||
/// at time of RPC creation.
|
||||
pub async fn new(url: String) -> Result<Rpc, RpcError> {
|
||||
let rpc = Rpc { client: Client::with_connection_pool(), url };
|
||||
let rpc =
|
||||
Rpc { client: Client::with_connection_pool().map_err(|_| RpcError::ConnectionError)?, url };
|
||||
|
||||
// Make an RPC request to verify the node is reachable and sane
|
||||
let res: String = rpc.rpc_call("help", json!([])).await?;
|
||||
|
||||
@@ -7,7 +7,7 @@ use std::io;
|
||||
use alloy_json_rpc::{RequestPacket, ResponsePacket};
|
||||
use alloy_transport::{TransportError, TransportErrorKind, TransportFut};
|
||||
|
||||
use simple_request::{hyper, Request, Client};
|
||||
use simple_request::{hyper, Error, Request, Client};
|
||||
|
||||
use tower::Service;
|
||||
|
||||
@@ -18,8 +18,8 @@ pub struct SimpleRequest {
|
||||
}
|
||||
|
||||
impl SimpleRequest {
|
||||
pub fn new(url: String) -> Self {
|
||||
Self { client: Client::with_connection_pool(), url }
|
||||
pub fn new(url: String) -> Result<Self, Error> {
|
||||
Ok(Self { client: Client::with_connection_pool()?, url })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ async fn setup_test() -> (AnvilInstance, Arc<RootProvider>, Address) {
|
||||
let anvil = Anvil::new().spawn();
|
||||
|
||||
let provider = Arc::new(RootProvider::new(
|
||||
ClientBuilder::default().transport(SimpleRequest::new(anvil.endpoint()), true),
|
||||
ClientBuilder::default().transport(SimpleRequest::new(anvil.endpoint()).unwrap(), true),
|
||||
));
|
||||
|
||||
let mut address = [0; 20];
|
||||
|
||||
Reference in New Issue
Block a user