diff --git a/src/components/views/dialogs/ChatInviteDialog.js b/src/components/views/dialogs/ChatInviteDialog.js index 867a3b423c..0c65f02525 100644 --- a/src/components/views/dialogs/ChatInviteDialog.js +++ b/src/components/views/dialogs/ChatInviteDialog.js @@ -61,6 +61,8 @@ module.exports = React.createClass({ // Whether a search is ongoing busy: false, + // An error message generated during the user directory search + searchError: null, // The query being searched for query: "", // List of AddressTile.InviteAddressType objects representing @@ -181,6 +183,7 @@ module.exports = React.createClass({ this.setState({ busy: true, query, + searchError: null, }); MatrixClientPeg.get().searchUserDirectory({ term: query, @@ -222,7 +225,12 @@ module.exports = React.createClass({ }, () => { this.addressSelector.moveSelectionTop(); }); - }).finally(() => { + }).catch((err) => { + console.error('Error whilst searching user directory: ', err); + this.setState({ + searchError: err.errcode ? err.message : _t('Something went wrong!'), + }); + }).done(() => { this.setState({ busy: false, }); @@ -232,6 +240,7 @@ module.exports = React.createClass({ this.setState({ queryList: [], query: "", + searchError: null, }); } }, @@ -494,6 +503,8 @@ module.exports = React.createClass({ let addressSelector; if (this.state.error) { error =