From d639eb10498e9ee6170bf1aa6477a4561cca6e09 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sun, 12 Mar 2017 23:26:26 +0000 Subject: [PATCH] beautify all error msgs --- src/components/structures/RoomDirectory.js | 5 +++-- src/components/structures/RoomSubList.js | 5 +++-- .../views/context_menus/RoomTagContextMenu.js | 15 +++++++++------ src/components/views/rooms/DNDRoomTile.js | 10 ++++++---- src/components/views/settings/Notifications.js | 15 +++++++++------ 5 files changed, 30 insertions(+), 20 deletions(-) diff --git a/src/components/structures/RoomDirectory.js b/src/components/structures/RoomDirectory.js index a6436885..e723cf1a 100644 --- a/src/components/structures/RoomDirectory.js +++ b/src/components/structures/RoomDirectory.js @@ -208,9 +208,10 @@ module.exports = React.createClass({ }, function(err) { modal.close(); this.refreshRoomList(); + console.error("Failed to " + step + ": " + err); Modal.createDialog(ErrorDialog, { - title: "Failed to "+step, - description: err.toString() + title: "Error", + description: "Failed to " + step, }); }); } diff --git a/src/components/structures/RoomSubList.js b/src/components/structures/RoomSubList.js index 0469f52a..67c47263 100644 --- a/src/components/structures/RoomSubList.js +++ b/src/components/structures/RoomSubList.js @@ -505,9 +505,10 @@ var RoomSubList = React.createClass({ // Do any final stuff here }).fail(function(err) { var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); + console.error("Failed to add tag " + self.props.tagName + " to room" + err); Modal.createDialog(ErrorDialog, { - title: "Failed to add tag " + self.props.tagName + " to room", - description: err.toString() + title: "Error", + description: "Failed to add tag " + self.props.tagName + " to room", }); }); break; diff --git a/src/components/views/context_menus/RoomTagContextMenu.js b/src/components/views/context_menus/RoomTagContextMenu.js index 8a44051f..19b5e6de 100644 --- a/src/components/views/context_menus/RoomTagContextMenu.js +++ b/src/components/views/context_menus/RoomTagContextMenu.js @@ -58,9 +58,10 @@ module.exports = React.createClass({ }; }).fail(function(err) { var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); + console.error("Failed to remove tag " + tagNameOff + " from room: " + err); Modal.createDialog(ErrorDialog, { - title: "Failed to remove tag " + tagNameOff + " from room", - description: err.toString() + title: "Error", + description: "Failed to remove tag " + tagNameOff + " from room", }); }); } @@ -75,9 +76,10 @@ module.exports = React.createClass({ }; }).fail(function(err) { var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); + console.error("Failed to add tag " + tagNameOn + " to room: " + err); Modal.createDialog(ErrorDialog, { - title: "Failed to add tag " + tagNameOn + " to room", - description: err.toString() + title: "Error", + description: "Failed to add tag " + tagNameOn + " to room", }); }); } @@ -148,9 +150,10 @@ module.exports = React.createClass({ }; }, (err) => { var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); + console.error("Failed to set DM status of room: " + err); Modal.createDialog(ErrorDialog, { - title: "Failed to set Direct Message status of room", - description: err.toString() + title: "Error", + description: "Failed to set Direct Message status of room", }); }); }); diff --git a/src/components/views/rooms/DNDRoomTile.js b/src/components/views/rooms/DNDRoomTile.js index 233fb8bb..6296552d 100644 --- a/src/components/views/rooms/DNDRoomTile.js +++ b/src/components/views/rooms/DNDRoomTile.js @@ -84,9 +84,10 @@ var roomTileSource = { //component.state.set({ spinner: component.state.spinner-- }); }).fail(function(err) { var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); + console.error("Failed to remove tag " + item.originalList.props.tagName + " from room: " + err); Modal.createDialog(ErrorDialog, { - title: "Failed to remove tag " + item.originalList.props.tagName + " from room", - description: err.toString() + title: "Error", + description: "Failed to remove tag " + item.originalList.props.tagName + " from room", }); }); } @@ -103,9 +104,10 @@ var roomTileSource = { //component.state.set({ spinner: component.state.spinner-- }); }).fail(function(err) { var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); + console.error("Failed to add tag " + item.targetList.props.tagName + " to room: " + err); Modal.createDialog(ErrorDialog, { - title: "Failed to add tag " + item.targetList.props.tagName + " to room", - description: err.toString() + title: "Error", + description: "Failed to add tag " + item.targetList.props.tagName + " to room", }); }); } diff --git a/src/components/views/settings/Notifications.js b/src/components/views/settings/Notifications.js index 506b34df..b5fc2f3d 100644 --- a/src/components/views/settings/Notifications.js +++ b/src/components/views/settings/Notifications.js @@ -238,9 +238,10 @@ module.exports = React.createClass({ self._refreshFromServer(); }, function(error) { var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); + console.error("Failed to change settings: " + error); Modal.createDialog(ErrorDialog, { - title: "Can't change settings", - description: error.toString(), + title: "Error", + description: "Failed to change settings", onFinished: self._refreshFromServer }); }); @@ -307,9 +308,10 @@ module.exports = React.createClass({ self._refreshFromServer(); }, function(error) { var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); + console.error("Can't update user notification settings: " + error); Modal.createDialog(ErrorDialog, { - title: "Can't update user notification settings", - description: error.toString(), + title: "Error", + description: "Can't update user notification settings", onFinished: self._refreshFromServer }); }); @@ -348,9 +350,10 @@ module.exports = React.createClass({ var onError = function(error) { var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); + console.error("Failed to update keywords: " + error); Modal.createDialog(ErrorDialog, { - title: "Can't update keywords", - description: error.toString(), + title: "Error", + description: "Failed to update keywords", onFinished: self._refreshFromServer }); }