aboutsummaryrefslogtreecommitdiffstats
path: root/stanza
diff options
context:
space:
mode:
authorLibravatar cel 🌸 <cel@bunny.garden>2025-03-26 19:13:10 +0000
committerLibravatar cel 🌸 <cel@bunny.garden>2025-03-26 19:13:10 +0000
commit8c239e5c7a49cff350104b09cbb74d862c2ec420 (patch)
tree4b392f1ffa6b91fadf68b4a7f67ad5f901fbeda4 /stanza
parent410fe3af16be5985c868b00908b8ddf4ed6e469d (diff)
downloadluz-8c239e5c7a49cff350104b09cbb74d862c2ec420.tar.gz
luz-8c239e5c7a49cff350104b09cbb74d862c2ec420.tar.bz2
luz-8c239e5c7a49cff350104b09cbb74d862c2ec420.zip
feat: stream error handling
Diffstat (limited to 'stanza')
-rw-r--r--stanza/src/client/mod.rs24
-rw-r--r--stanza/src/stream.rs4
2 files changed, 26 insertions, 2 deletions
diff --git a/stanza/src/client/mod.rs b/stanza/src/client/mod.rs
index 3e690a7..a1b2de5 100644
--- a/stanza/src/client/mod.rs
+++ b/stanza/src/client/mod.rs
@@ -61,3 +61,27 @@ impl IntoContent for Stanza {
}
}
}
+
+impl From<Message> for Stanza {
+ fn from(value: Message) -> Self {
+ Stanza::Message(value)
+ }
+}
+
+impl From<Presence> for Stanza {
+ fn from(value: Presence) -> Self {
+ Stanza::Presence(value)
+ }
+}
+
+impl From<Iq> for Stanza {
+ fn from(value: Iq) -> Self {
+ Stanza::Iq(value)
+ }
+}
+
+impl From<StreamError> for Stanza {
+ fn from(value: StreamError) -> Self {
+ Stanza::Error(value)
+ }
+}
diff --git a/stanza/src/stream.rs b/stanza/src/stream.rs
index 8e1982f..732a826 100644
--- a/stanza/src/stream.rs
+++ b/stanza/src/stream.rs
@@ -181,8 +181,8 @@ impl FromElement for Feature {
#[derive(Error, Debug, Clone)]
pub struct Error {
- error: StreamError,
- text: Option<Text>,
+ pub error: StreamError,
+ pub text: Option<Text>,
}
impl Display for Error {