diff --git a/src/headless/converse-core.js b/src/headless/converse-core.js index ad0f1626a..8d529555b 100644 --- a/src/headless/converse-core.js +++ b/src/headless/converse-core.js @@ -885,6 +885,11 @@ const api = _converse.api = { let promise; if (reject) { 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 { promise = new Promise(resolve => _converse.connection.sendIQ(stanza, resolve, resolve, timeout)); } diff --git a/src/headless/converse-disco.js b/src/headless/converse-disco.js index dc83560b1..6147a0544 100644 --- a/src/headless/converse-disco.js +++ b/src/headless/converse-disco.js @@ -147,7 +147,7 @@ converse.plugins.add('converse-disco', { try { stanza = await api.disco.info(this.get('jid'), null); } 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); return; }