diff --git a/src/error.rs b/src/error.rs index 203a5f7..c64403b 100644 --- a/src/error.rs +++ b/src/error.rs @@ -25,8 +25,8 @@ pub enum Error { NickAlreadyAssigned(String), NonexistantSession(FullJid), SessionAlreadyExists(FullJid), - XMPPError(TokioXMPPError), - ParserError(ParserError), + Xmpp(Box), + Parser(Box), } impl StdError for Error {} @@ -38,20 +38,20 @@ impl fmt::Display for Error { Error::NickAlreadyAssigned(err) => write!(f, "Nickname already assigned: {}", err), Error::NonexistantSession(err) => write!(f, "Session doesn't exist: {}", err), Error::SessionAlreadyExists(err) => write!(f, "Session already exist: {}", err), - Error::XMPPError(err) => write!(f, "XMPP error: {}", err), - Error::ParserError(err) => write!(f, "Parser error: {}", err), + Error::Xmpp(err) => write!(f, "XMPP error: {}", err), + Error::Parser(err) => write!(f, "Parser error: {}", err), } } } impl From for Error { fn from(err: TokioXMPPError) -> Error { - Error::XMPPError(err) + Error::Xmpp(Box::new(err)) } } impl From for Error { fn from(err: ParserError) -> Error { - Error::ParserError(err) + Error::Parser(Box::new(err)) } } diff --git a/src/main.rs b/src/main.rs index 9787675..5d27ee1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -14,6 +14,8 @@ // along with this program. If not, see . #![feature(let_chains)] +// Maybe change that someday? +#![allow(clippy::result_large_err)] mod component; mod error;