Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Ensure errors when creating a DM are raised to the user
Browse files Browse the repository at this point in the history
Fixes element-hq/element-web#12186

Note: this will still result in an empty room being created, but that's a Synapse issue and not something we can solve.
  • Loading branch information
turt2live committed Feb 28, 2020
1 parent 5325b56 commit 46a6af0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/views/dialogs/AskInviteAnywayDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export default createReactClass({
<button onClick={this._onInviteNeverWarnClicked}>
{ _t('Invite anyway and never warn me again') }
</button>
<button onClick={this._onInviteClicked} autoFocus="true">
<button onClick={this._onInviteClicked} autoFocus={true}>
{ _t('Invite anyway') }
</button>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/views/dialogs/InviteDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ export default class InviteDialog extends React.PureComponent {
return;
}

const createRoomOptions = {};
const createRoomOptions = {inlineErrors: true};

if (SettingsStore.isFeatureEnabled("feature_cross_signing")) {
// Check whether all users have uploaded device keys before.
Expand Down
5 changes: 5 additions & 0 deletions src/createRoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ import SettingsStore from "./settings/SettingsStore";
* Default: True
* @param {bool=} opts.encryption Whether to enable encryption.
* Default: False
* @param {bool=} opts.inlineErrors True to raise errors off the promise instead of resolving to null.
* Default: False
*
* @returns {Promise} which resolves to the room id, or null if the
* action was aborted or failed.
Expand Down Expand Up @@ -140,6 +142,9 @@ export default function createRoom(opts) {
}
return roomId;
}, function(err) {
// Raise the error if the caller requested that we do so.
if (opts.inlineErrors) throw err;

// We also failed to join the room (this sets joining to false in RoomViewStore)
dis.dispatch({
action: 'join_room_error',
Expand Down

0 comments on commit 46a6af0

Please sign in to comment.