Software /
code /
verse
Diff
client.lua @ 364:69fc23b44819
client: Deal with eg no-stream errors where no stanza is passed
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 30 Sep 2014 12:18:28 +0200 |
parent | 344:ea668c47e1bd |
child | 400:0db9cb909cf1 |
line wrap: on
line diff
--- a/client.lua Tue Sep 30 12:16:33 2014 +0200 +++ b/client.lua Tue Sep 30 12:18:28 2014 +0200 @@ -53,9 +53,13 @@ function stream_callbacks.error(stream, e, stanza) if stream:event(e, stanza) == nil then - local err = stanza:get_child(nil, "urn:ietf:params:xml:ns:xmpp-streams"); - local text = stanza:get_child_text("text", "urn:ietf:params:xml:ns:xmpp-streams"); - error(err.name..(text and ": "..text or "")); + if stanza then + local err = stanza:get_child(nil, "urn:ietf:params:xml:ns:xmpp-streams"); + local text = stanza:get_child_text("text", "urn:ietf:params:xml:ns:xmpp-streams"); + error(err.name..(text and ": "..text or "")); + else + error(stanza and stanza.name or e or "unknown-error"); + end end end