diff --git a/src/imap.rs b/src/imap.rs index 4365cb6a28..da162a73f8 100644 --- a/src/imap.rs +++ b/src/imap.rs @@ -356,10 +356,10 @@ impl Imap { context, self.proxy_config.clone(), self.strict_tls, - connection_candidate, + &connection_candidate, ) .await - .context("IMAP failed to connect") + .with_context(|| format!("IMAP failed to connect to {connection_candidate}")) { Ok(client) => client, Err(err) => { diff --git a/src/imap/client.rs b/src/imap/client.rs index d1161878f8..335557fce0 100644 --- a/src/imap/client.rs +++ b/src/imap/client.rs @@ -150,7 +150,7 @@ impl Client { Err(err) => { warn!( context, - "Failed to connect to {host} ({resolved_addr}): {err:#}." + "IMAP failed to connect to {host} ({resolved_addr}): {err:#}." ); Err(err) } @@ -161,7 +161,7 @@ impl Client { context: &Context, proxy_config: Option, strict_tls: bool, - candidate: ConnectionCandidate, + candidate: &ConnectionCandidate, ) -> Result { let host = &candidate.host; let port = candidate.port; diff --git a/src/net.rs b/src/net.rs index 40c12568f6..3ff181efd9 100644 --- a/src/net.rs +++ b/src/net.rs @@ -109,8 +109,8 @@ pub(crate) async fn connect_tcp_inner( ) -> Result>>> { let tcp_stream = timeout(TIMEOUT, TcpStream::connect(addr)) .await - .context("connection timeout")? - .context("connection failure")?; + .context("Connection timeout")? + .context("Connection failure")?; // Disable Nagle's algorithm. tcp_stream.set_nodelay(true)?; diff --git a/src/smtp/connect.rs b/src/smtp/connect.rs index 22846cad78..e535b77c9e 100644 --- a/src/smtp/connect.rs +++ b/src/smtp/connect.rs @@ -136,7 +136,7 @@ async fn connection_attempt( Err(err) => { warn!( context, - "Failed to connect to {host} ({resolved_addr}): {err:#}." + "SMTP failed to connect to {host} ({resolved_addr}): {err:#}." ); Err(err) }