diff options
Diffstat (limited to 'stanza/src/stream_error.rs')
-rw-r--r-- | stanza/src/stream_error.rs | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/stanza/src/stream_error.rs b/stanza/src/stream_error.rs index 5ae04a6..c1537ff 100644 --- a/stanza/src/stream_error.rs +++ b/stanza/src/stream_error.rs @@ -2,35 +2,61 @@ use peanuts::{ element::{FromElement, IntoElement}, DeserializeError, Element, XML_NS, }; +use thiserror::Error; pub const XMLNS: &str = "urn:ietf:params:xml:ns:xmpp-streams"; -#[derive(Clone, Debug)] +#[derive(Error, Clone, Debug)] pub enum Error { + #[error("bad format")] BadFormat, + #[error("bad namespace prefix")] BadNamespacePrefix, + #[error("conflict")] Conflict, + #[error("connection timeout")] ConnectionTimeout, + #[error("host gone")] HostGone, + #[error("host unknown")] HostUnknown, + #[error("improper addressing")] ImproperAddressing, + #[error("internal server error")] InternalServerError, + #[error("invalid from")] InvalidFrom, + #[error("invalid id")] InvalidId, + #[error("invalid namespace")] InvalidNamespace, + #[error("invalid xml")] InvalidXml, + #[error("not authorized")] NotAuthorized, + #[error("not well formed")] NotWellFormed, + #[error("policy violation")] PolicyViolation, + #[error("remote connection failed")] RemoteConnectionFailed, + #[error("reset")] Reset, + #[error("resource constraint")] ResourceConstraint, + #[error("restricted xml")] RestrictedXml, + #[error("see other host: {0:?}")] SeeOtherHost(Option<String>), + #[error("system shutdown")] SystemShutdown, + #[error("undefined condition")] UndefinedCondition, + #[error("unsupported encoding")] UnsupportedEncoding, + #[error("unsupported stanza type")] UnsupportedStanzaType, + #[error("unsupported version")] UnsupportedVersion, } |