# HG changeset patch # User Emmanuel Gil Peyrot # Date 1545592120 -3600 # Node ID b15e1581c3d47c6cd39bf80bdbe7b4522f92cba6 # Parent e561bdd817772f672bb8016b7d94f7c147e01df0 Allow iq error to not have a . diff --git a/util.js b/util.js --- 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) { diff --git a/vcard.js b/vcard.js --- a/vcard.js +++ b/vcard.js @@ -42,8 +42,7 @@ function initVCard(connection) { function onVCard4RetrievalError(iq, string) { if (!string) { - const [condition, text] = parseErrorIq(iq); - const string = condition + ': ' + text; + string = parseErrorIq(iq); } string = 'Failed to retrieve vCard4: ' + string; console.log(string); @@ -82,8 +81,8 @@ function initVCard(connection) { function onVCard4ChangeError(iq) { - const [condition, text] = parseErrorIq(iq); - const string = 'Failed to set vCard4: ' + condition + ': ' + text; + const string = parseErrorIq(iq); + const string = 'Failed to set vCard4: ' + string; console.log(string); spinnerError(spinner_img, string); }