From 18321ed15ce782ff5d1f24de9f2fb459d714d125 Mon Sep 17 00:00:00 2001 From: Marvin W Date: Tue, 31 Jan 2023 15:12:39 +0100 Subject: Collapse most stream releated errors into IOError --- xmpp-vala/src/core/xmpp_stream.vala | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) (limited to 'xmpp-vala/src/core/xmpp_stream.vala') 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()); } } } -- cgit v1.2.3-54-g00ecf