Add responsible error handling because we're responsible people

This commit is contained in:
Travis Ralston 2019-09-04 11:24:31 -06:00
parent 2e3e2ec420
commit d6adf0fd6d
2 changed files with 14 additions and 1 deletions

View file

@ -164,7 +164,18 @@ export default class RolesRoomSettingsTab extends React.Component {
if (!plContent['users']) plContent['users'] = {};
plContent['users'][powerLevelKey] = value;
client.sendStateEvent(this.props.roomId, "m.room.power_levels", plContent);
client.sendStateEvent(this.props.roomId, "m.room.power_levels", plContent).catch(e => {
console.error(e);
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
Modal.createTrackedDialog('Power level change failed', '', ErrorDialog, {
title: _t('Error changing power level'),
description: _t(
"An error occurred changing the user's power level. Ensure you have sufficient " +
"permissions and try again.",
),
});
});
};
render() {

View file

@ -689,6 +689,8 @@
"Failed to unban": "Failed to unban",
"Unban": "Unban",
"Banned by %(displayName)s": "Banned by %(displayName)s",
"Error changing power level": "Error changing power level",
"An error occurred changing the user's power level. Ensure you have sufficient permissions and try again.": "An error occurred changing the user's power level. Ensure you have sufficient permissions and try again.",
"Default role": "Default role",
"Send messages": "Send messages",
"Invite users": "Invite users",