Commit bb0e4d26 authored by JC Brand's avatar JC Brand

Throw more helpful error when there's no connection

parent c789af34
...@@ -333,7 +333,12 @@ ...@@ -333,7 +333,12 @@
/* Extend default converse.js API to add methods specific to MAM /* Extend default converse.js API to add methods specific to MAM
*/ */
'archive': { 'archive': {
'query': _converse.queryForArchivedMessages.bind(_converse) 'query': function () {
if (!_converse.api.connection.connected()) {
throw new Error('Can\'t call `api.archive.query` before having established an XMPP session');
}
return _converse.queryForArchivedMessages.apply(this, arguments);
}
} }
}); });
......
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