Make sure IQ timeouts are properly logged

This commit is contained in:
JC Brand 2020-04-10 14:41:23 +02:00
parent 4425c3dde7
commit 35de251ce7
2 changed files with 6 additions and 1 deletions

View File

@ -885,6 +885,11 @@ const api = _converse.api = {
let promise; let promise;
if (reject) { if (reject) {
promise = new Promise((resolve, reject) => _converse.connection.sendIQ(stanza, resolve, reject, timeout)); promise = new Promise((resolve, reject) => _converse.connection.sendIQ(stanza, resolve, reject, timeout));
promise.catch(e => {
if (e === null) {
throw new TimeoutError(`Timeout error after ${timeout}ms for the following IQ stanza: ${stanza}`);
}
});
} else { } else {
promise = new Promise(resolve => _converse.connection.sendIQ(stanza, resolve, resolve, timeout)); promise = new Promise(resolve => _converse.connection.sendIQ(stanza, resolve, resolve, timeout));
} }

View File

@ -147,7 +147,7 @@ converse.plugins.add('converse-disco', {
try { try {
stanza = await api.disco.info(this.get('jid'), null); stanza = await api.disco.info(this.get('jid'), null);
} catch (iq) { } catch (iq) {
log.error(iq); iq === null ? log.error(`Timeout for disco#info query for ${this.get('jid')}`) : log.error(iq);
this.waitUntilFeaturesDiscovered.resolve(this); this.waitUntilFeaturesDiscovered.resolve(this);
return; return;
} }