aboutsummaryrefslogtreecommitdiff
path: root/xmpp-vala/src/module
diff options
context:
space:
mode:
authorMarvin W <git@larma.de>2023-01-31 15:12:39 +0100
committerMarvin W <git@larma.de>2023-02-07 10:50:43 +0100
commit18321ed15ce782ff5d1f24de9f2fb459d714d125 (patch)
treebaf849afe826691b351110b8899701f698692eb9 /xmpp-vala/src/module
parent95fefaff51e5506d3f0e5fe8bced14aeb3fbe037 (diff)
downloaddino-18321ed15ce782ff5d1f24de9f2fb459d714d125.tar.gz
dino-18321ed15ce782ff5d1f24de9f2fb459d714d125.zip
Collapse most stream releated errors into IOError
Diffstat (limited to 'xmpp-vala/src/module')
-rw-r--r--xmpp-vala/src/module/message/module.vala8
-rw-r--r--xmpp-vala/src/module/xep/0198_stream_management.vala8
-rw-r--r--xmpp-vala/src/module/xep/0444_reactions.vala2
3 files changed, 7 insertions, 11 deletions
diff --git a/xmpp-vala/src/module/message/module.vala b/xmpp-vala/src/module/message/module.vala
index ef39a663..bb63bca4 100644
--- a/xmpp-vala/src/module/message/module.vala
+++ b/xmpp-vala/src/module/message/module.vala
@@ -15,13 +15,9 @@ namespace Xmpp {
public signal void received_error(XmppStream stream, MessageStanza message, ErrorStanza error);
public signal void received_message_unprocessed(XmppStream stream, MessageStanza message);
- public async void send_message(XmppStream stream, MessageStanza message) throws IOStreamError {
+ public async void send_message(XmppStream stream, MessageStanza message) throws IOError {
yield send_pipeline.run(stream, message);
- try {
- yield stream.write_async(message.stanza);
- } catch (IOStreamError e) {
- throw new SendError.IO(e.message);
- }
+ yield stream.write_async(message.stanza);
}
public async void received_message_stanza_async(XmppStream stream, StanzaNode node) {
diff --git a/xmpp-vala/src/module/xep/0198_stream_management.vala b/xmpp-vala/src/module/xep/0198_stream_management.vala
index 5ce208f1..340c4e6f 100644
--- a/xmpp-vala/src/module/xep/0198_stream_management.vala
+++ b/xmpp-vala/src/module/xep/0198_stream_management.vala
@@ -25,7 +25,7 @@ public class Module : XmppStreamNegotiationModule, WriteNodeFunc {
}
}
- public async void write_stanza(XmppStream stream, StanzaNode node) throws IOStreamError {
+ public async void write_stanza(XmppStream stream, StanzaNode node) throws IOError {
var promise = new Promise<IOError?>();
node_queue.add(new QueueItem(node, promise));
@@ -34,7 +34,7 @@ public class Module : XmppStreamNegotiationModule, WriteNodeFunc {
try {
yield promise.future.wait_async();
} catch (FutureError e) {
- throw new IOStreamError.WRITE("Future returned error %i".printf(e.code));
+ throw new IOError.FAILED("Future returned error %i".printf(e.code));
}
}
@@ -50,7 +50,7 @@ public class Module : XmppStreamNegotiationModule, WriteNodeFunc {
} else {
yield ((!)writer).write_node(node);
}
- } catch (XmlError e) { }
+ } catch (IOError e) { }
}
private void check_queue(XmppStream stream) {
@@ -158,7 +158,7 @@ public class Module : XmppStreamNegotiationModule, WriteNodeFunc {
handle_incoming_h(stream, h_outbound);
}
foreach (var id in in_flight_stanzas.keys) {
- in_flight_stanzas[id].promise.set_exception(new IOStreamError.WRITE("Stanza not acked and session not resumed"));
+ in_flight_stanzas[id].promise.set_exception(new IOError.FAILED("Stanza not acked and session not resumed"));
}
in_flight_stanzas.clear();
check_queue(stream);
diff --git a/xmpp-vala/src/module/xep/0444_reactions.vala b/xmpp-vala/src/module/xep/0444_reactions.vala
index 6e76f1f0..877d3070 100644
--- a/xmpp-vala/src/module/xep/0444_reactions.vala
+++ b/xmpp-vala/src/module/xep/0444_reactions.vala
@@ -11,7 +11,7 @@ public class Module : XmppStreamModule {
private ReceivedPipelineListener received_pipeline_listener = new ReceivedPipelineListener();
- public async void send_reaction(XmppStream stream, Jid jid, string stanza_type, string message_id, Gee.List<string> reactions) throws SendError {
+ public async void send_reaction(XmppStream stream, Jid jid, string stanza_type, string message_id, Gee.List<string> reactions) throws IOError {
StanzaNode reactions_node = new StanzaNode.build("reactions", NS_URI).add_self_xmlns();
reactions_node.put_attribute("id", message_id);
foreach (string reaction in reactions) {