summaryrefslogtreecommitdiffstats
path: root/src/error.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/error.rs31
1 files changed, 30 insertions, 1 deletions
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<MechanismNameError> for JabberError {
}
impl From<Utf8Error> for JabberError {
- fn from(e: Utf8Error) -> Self {
+ fn from(_e: Utf8Error) -> Self {
Self::Utf8Decode
}
}
@@ -42,3 +53,21 @@ impl From<quick_xml::Error> for JabberError {
Self::XML(e)
}
}
+
+impl From<element::ElementError<'static>> for JabberError {
+ fn from(e: element::ElementError<'static>) -> Self {
+ Self::Element(e)
+ }
+}
+
+impl From<AttrError> for JabberError {
+ fn from(e: AttrError) -> Self {
+ Self::XML(e.into())
+ }
+}
+
+impl From<ParseError> for JabberError {
+ fn from(e: ParseError) -> Self {
+ Self::JID(e)
+ }
+}