diff options
author | Marvin W <git@larma.de> | 2023-01-31 15:12:39 +0100 |
---|---|---|
committer | Marvin W <git@larma.de> | 2023-02-07 10:50:43 +0100 |
commit | 18321ed15ce782ff5d1f24de9f2fb459d714d125 (patch) | |
tree | baf849afe826691b351110b8899701f698692eb9 /xmpp-vala/src/core/xmpp_stream.vala | |
parent | 95fefaff51e5506d3f0e5fe8bced14aeb3fbe037 (diff) | |
download | dino-18321ed15ce782ff5d1f24de9f2fb459d714d125.tar.gz dino-18321ed15ce782ff5d1f24de9f2fb459d714d125.zip |
Collapse most stream releated errors into IOError
Diffstat (limited to 'xmpp-vala/src/core/xmpp_stream.vala')
-rw-r--r-- | xmpp-vala/src/core/xmpp_stream.vala | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/xmpp-vala/src/core/xmpp_stream.vala b/xmpp-vala/src/core/xmpp_stream.vala index 0f0793e9..6370554f 100644 --- a/xmpp-vala/src/core/xmpp_stream.vala +++ b/xmpp-vala/src/core/xmpp_stream.vala @@ -1,13 +1,5 @@ using Gee; -public errordomain Xmpp.IOStreamError { - READ, - WRITE, - CONNECT, - DISCONNECT, - TLS -} - public abstract class Xmpp.XmppStream { public signal void received_node(XmppStream stream, StanzaNode node); @@ -38,18 +30,18 @@ public abstract class Xmpp.XmppStream { this.remote_name = remote_name; } - public abstract async void connect() throws IOStreamError; + public abstract async void connect() throws IOError; - public abstract async void disconnect() throws IOStreamError, XmlError, IOError; + public abstract async void disconnect() throws IOError; - public abstract async StanzaNode read() throws IOStreamError; + public abstract async StanzaNode read() throws IOError; [Version (deprecated = true, deprecated_since = "0.1", replacement = "write_async")] public abstract void write(StanzaNode node); - public abstract async void write_async(StanzaNode node) throws IOStreamError; + public abstract async void write_async(StanzaNode node) throws IOError; - public abstract async void setup() throws IOStreamError; + public abstract async void setup() throws IOError; public void require_setup() { setup_needed = true; @@ -105,7 +97,7 @@ public abstract class Xmpp.XmppStream { return null; } - public async void loop() throws IOStreamError { + public async void loop() throws IOError { while (true) { if (setup_needed) { yield setup(); @@ -168,7 +160,7 @@ public abstract class Xmpp.XmppStream { return false; } - private bool negotiation_modules_done() throws IOStreamError { + private bool negotiation_modules_done() throws IOError { if (setup_needed) return false; if (is_negotiation_active()) return false; @@ -176,7 +168,7 @@ public abstract class Xmpp.XmppStream { if (module is XmppStreamNegotiationModule) { XmppStreamNegotiationModule negotiation_module = (XmppStreamNegotiationModule) module; if (negotiation_module.mandatory_outstanding(this)) { - throw new IOStreamError.CONNECT("mandatory-to-negotiate feature not negotiated: " + negotiation_module.get_id()); + throw new IOError.FAILED("mandatory-to-negotiate feature not negotiated: " + negotiation_module.get_id()); } } } |