diff util.js @ 32:b15e1581c3d4

Allow iq error to not have a <text/>.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sun, 23 Dec 2018 20:08:40 +0100
parents 9ba4f8cc32f1
children 021185105e2f
line wrap: on
line diff
--- a/util.js
+++ b/util.js
@@ -62,9 +62,11 @@ function parseErrorIq(iq) {
     if (condition.namespaceURI !== 'urn:ietf:params:xml:ns:xmpp-stanzas')
         return null;
     const text = error.lastChild;
+    if (text === condition)
+        return condition.localName;
     if (text.namespaceURI !== 'urn:ietf:params:xml:ns:xmpp-stanzas' || text.localName !== 'text')
         return null;
-    return [condition.localName, text.textContent];
+    return condition.localName + ': ' + text.textContent;
 }
 
 function displaySpinner(spinner) {