Throw more helpful error when there's no connection
This commit is contained in:
parent
c789af346f
commit
bb0e4d26ec
@ -333,7 +333,12 @@
|
||||
/* Extend default converse.js API to add methods specific to MAM
|
||||
*/
|
||||
'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);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user