diff --git a/tokio-xmpp/ChangeLog b/tokio-xmpp/ChangeLog index 2d585a3460ca3b4e858e8bd2c6b61b9519aa1892..924ca65e5fd9a7af71533ff25c3874ea4726b937 100644 --- a/tokio-xmpp/ChangeLog +++ b/tokio-xmpp/ChangeLog @@ -3,6 +3,8 @@ XXXX-YY-ZZ RELEASER * Breaking: - Remove `tokio_xmpp::ParseError` and `tokio_xmpp::starttls::ParseError` which were never used - Removed StreamFeatures from this crate, replaced with xmpp_parsers::stream_features::StreamFeatures (!400) + - `starttls::error::ConnectorError` variants have been merged with `starttls::error::Error`, except `ConnectorError::AllFailed` + which was not used and has been completely removed (!418) Version 4.0.0: 2024-07-26 Maxime “pep” Buquet diff --git a/tokio-xmpp/src/starttls/error.rs b/tokio-xmpp/src/starttls/error.rs index 5b447beea9e7d05894d26656968cb1c019215f56..cab2dc943c542f3a9eb463f93b24efe7cd5978c5 100644 --- a/tokio-xmpp/src/starttls/error.rs +++ b/tokio-xmpp/src/starttls/error.rs @@ -13,8 +13,10 @@ use tokio_rustls::rustls::Error as TlsError; /// StartTLS ServerConnector Error #[derive(Debug)] pub enum Error { - /// Error resolving DNS and establishing a connection - Connection(ConnectorError), + /// DNS protocol error + Dns(ProtoError), + /// DNS resolution error + Resolve(ResolveError), /// DNS label conversion error, no details available from module /// `idna` Idna, @@ -30,7 +32,8 @@ pub enum Error { impl fmt::Display for Error { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { match self { - Error::Connection(e) => write!(fmt, "connection error: {}", e), + Error::Dns(e) => write!(fmt, "{:?}", e), + Error::Resolve(e) => write!(fmt, "{:?}", e), Error::Idna => write!(fmt, "IDNA error"), Error::Tls(e) => write!(fmt, "TLS error: {}", e), #[cfg(all(feature = "tls-rust", not(feature = "tls-native")))] @@ -48,12 +51,6 @@ impl From for Error { } } -impl From for Error { - fn from(e: ConnectorError) -> Self { - Error::Connection(e) - } -} - impl From for Error { fn from(e: TlsError) -> Self { Error::Tls(e) @@ -66,22 +63,3 @@ impl From for Error { Error::DnsNameError(e) } } - -/// Error establishing connection -#[derive(Debug)] -pub enum ConnectorError { - /// All attempts failed, no error available - AllFailed, - /// DNS protocol error - Dns(ProtoError), - /// DNS resolution error - Resolve(ResolveError), -} - -impl StdError for ConnectorError {} - -impl std::fmt::Display for ConnectorError { - fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> { - write!(fmt, "{:?}", self) - } -} diff --git a/tokio-xmpp/src/starttls/happy_eyeballs.rs b/tokio-xmpp/src/starttls/happy_eyeballs.rs index 1c4de86eb553ea134206d977239e69880885212d..8a73297c40dea93bf3f8a708ac483c7c070909c8 100644 --- a/tokio-xmpp/src/starttls/happy_eyeballs.rs +++ b/tokio-xmpp/src/starttls/happy_eyeballs.rs @@ -1,4 +1,4 @@ -use super::error::{ConnectorError, Error}; +use super::error::Error; use futures::{future::select_ok, FutureExt}; use hickory_resolver::{ config::LookupIpStrategy, name_server::TokioConnectionProvider, IntoName, TokioAsyncResolver, @@ -17,14 +17,14 @@ pub async fn connect_to_host(domain: &str, port: u16) -> Result