Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions crates/node/ethstats/src/ethstats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,9 @@ where
"Attempting to connect to EthStats server at {}", self.credentials.host
);
let full_url = format!("ws://{}/api", self.credentials.host);
let url = Url::parse(&full_url)
.map_err(|e| EthStatsError::InvalidUrl(format!("Invalid URL: {full_url} - {e}")))?;
let url = Url::parse(&full_url).map_err(EthStatsError::Url)?;

match timeout(CONNECT_TIMEOUT, connect_async(url.to_string())).await {
match timeout(CONNECT_TIMEOUT, connect_async(url.as_str())).await {
Ok(Ok((ws_stream, _))) => {
debug!(
target: "ethstats",
Expand All @@ -123,7 +122,7 @@ where
self.login().await?;
Ok(())
}
Ok(Err(e)) => Err(EthStatsError::InvalidUrl(e.to_string())),
Ok(Err(e)) => Err(EthStatsError::WebSocket(e)),
Err(_) => {
debug!(target: "ethstats", "Connection to EthStats server timed out");
Err(EthStatsError::Timeout)
Expand Down
Loading