From f43911ccbae3856b35b0d3e8ec6ac6450e295da6 Mon Sep 17 00:00:00 2001 From: cel 🌸 Date: Tue, 11 Jul 2023 21:28:42 +0100 Subject: remove serde functions --- src/error.rs | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'src/error.rs') diff --git a/src/error.rs b/src/error.rs index 20ebc3e..37be7fa 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,7 +1,13 @@ use std::str::Utf8Error; +use quick_xml::events::attributes::AttrError; use rsasl::mechname::MechanismNameError; +use crate::{ + element::{self, ElementError}, + jid::ParseError, +}; + #[derive(Debug)] pub enum JabberError { Connection, @@ -9,8 +15,13 @@ pub enum JabberError { StartTlsUnavailable, TlsNegotiation, Utf8Decode, + NoFeatures, + UnknownNamespace, + ParseError, XML(quick_xml::Error), SASL(SASLError), + Element(ElementError<'static>), + JID(ParseError), } #[derive(Debug)] @@ -32,7 +43,7 @@ impl From for JabberError { } impl From for JabberError { - fn from(e: Utf8Error) -> Self { + fn from(_e: Utf8Error) -> Self { Self::Utf8Decode } } @@ -42,3 +53,21 @@ impl From for JabberError { Self::XML(e) } } + +impl From> for JabberError { + fn from(e: element::ElementError<'static>) -> Self { + Self::Element(e) + } +} + +impl From for JabberError { + fn from(e: AttrError) -> Self { + Self::XML(e.into()) + } +} + +impl From for JabberError { + fn from(e: ParseError) -> Self { + Self::JID(e) + } +} -- cgit