Commit ea123e97 authored by JC Brand's avatar JC Brand

Handle IQ timeouts

* converse-muc: Handle timeout while fetching affiliation list
* converse-omemo: Handle IQ timeout
parent a407aff3
......@@ -1004,8 +1004,12 @@ converse.plugins.add('converse-omemo', {
try {
ids = await this.fetchDevicesFromServer()
} catch (e) {
_converse.log(`Could not fetch devices for ${this.get('jid')}`);
_converse.log(e, Strophe.LogLevel.ERROR);
if (e === null) {
_converse.log(`Timeout error while fetching devices for ${this.get('jid')}`, Strophe.LogLevel.ERROR);
} else {
_converse.log(`Could not fetch devices for ${this.get('jid')}`, Strophe.LogLevel.ERROR);
_converse.log(e, Strophe.LogLevel.ERROR);
}
this.destroy();
}
if (this.get('jid') === _converse.bare_jid) {
......
......@@ -1111,7 +1111,14 @@ converse.plugins.add('converse-muc', {
.c("query", {xmlns: Strophe.NS.MUC_ADMIN})
.c("item", {'affiliation': affiliation});
const result = await _converse.api.sendIQ(iq, null, false);
if (result.getAttribute('type') === 'error') {
if (result === null) {
const err_msg = `Error: timeout while fetching ${affiliation} list for MUC ${this.get('jid')}`;
const err = new Error(err_msg);
_converse.log(err_msg, Strophe.LogLevel.WARN);
_converse.log(result, Strophe.LogLevel.WARN);
return err;
}
if (u.isErrorStanza(result)) {
const err_msg = `Error: not allowed to fetch ${affiliation} list for MUC ${this.get('jid')}`;
const err = new Error(err_msg);
_converse.log(err_msg, Strophe.LogLevel.WARN);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment