(stanza)
| 291 | * @param {Element} stanza - The message stanza |
| 292 | */ |
| 293 | export function getErrorAttributes(stanza) { |
| 294 | if (stanza.getAttribute('type') === 'error') { |
| 295 | const error = stanza.querySelector('error'); |
| 296 | const text = sizzle(`text[xmlns="${Strophe.NS.STANZAS}"]`, error).pop(); |
| 297 | return { |
| 298 | is_error: true, |
| 299 | error_text: text?.textContent, |
| 300 | error_type: error.getAttribute('type'), |
| 301 | error_condition: error.firstElementChild.nodeName, |
| 302 | errors: Array.from(error.children).map((e) => ({ name: e.nodeName, xmlns: e.getAttribute('xmlns') })), |
| 303 | }; |
| 304 | } |
| 305 | return {}; |
| 306 | } |
| 307 | |
| 308 | /** |
| 309 | * Given a message stanza, extract XEP-0461 reply attributes |
no test coverage detected