diff options
author | 2025-02-25 19:11:25 +0000 | |
---|---|---|
committer | 2025-02-25 19:11:25 +0000 | |
commit | 4fe4ab9d838ff967395ebaf79145163d28e7db74 (patch) | |
tree | 79f454f9e64c52a05d3173598f5e549e42c589f9 /stanza/src/stream_error.rs | |
parent | 3c412ea6b05fbc0c399cf95e1658bfd50492e722 (diff) | |
download | luz-4fe4ab9d838ff967395ebaf79145163d28e7db74.tar.gz luz-4fe4ab9d838ff967395ebaf79145163d28e7db74.tar.bz2 luz-4fe4ab9d838ff967395ebaf79145163d28e7db74.zip |
implement Error for stanza crate error types
Diffstat (limited to '')
-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, } |