aboutsummaryrefslogtreecommitdiff
path: root/xmpp-vala/src/core/stanza_reader.vala
diff options
context:
space:
mode:
Diffstat (limited to 'xmpp-vala/src/core/stanza_reader.vala')
-rw-r--r--xmpp-vala/src/core/stanza_reader.vala11
1 files changed, 9 insertions, 2 deletions
diff --git a/xmpp-vala/src/core/stanza_reader.vala b/xmpp-vala/src/core/stanza_reader.vala
index ff512497..4828600d 100644
--- a/xmpp-vala/src/core/stanza_reader.vala
+++ b/xmpp-vala/src/core/stanza_reader.vala
@@ -38,8 +38,15 @@ public class StanzaReader {
if (cancellable != null && cancellable.is_cancelled()) throw new IOError.CANCELLED("Input stream is canceled.");
try {
buffer_fill = (int) yield ((!)input).read_async(buffer, GLib.Priority.DEFAULT, cancellable);
- } catch (TlsError.EOF e) {
- throw new IOError.CLOSED("End of TLS stream reached");
+ } catch (Error e) {
+ if (e is IOError) {
+ throw (IOError) e;
+ } else if (e is TlsError.EOF) {
+ // The error can be TlsError.EOF instead of IOError.CLOSED, fixing that
+ throw new IOError.CLOSED("End of TLS stream reached");
+ } else {
+ throw new IOError.FAILED("Unknown error: %s", e.message);
+ }
}
if (buffer_fill == 0) throw new IOError.CLOSED("End of input stream reached.");
buffer_pos = 0;