show err.message in errors if present

This commit is contained in:
Matthew Hodgson 2017-04-23 02:22:31 +01:00
parent ab5ec04507
commit 40eceaf9bc
5 changed files with 22 additions and 22 deletions

View file

@ -161,7 +161,7 @@ module.exports = React.createClass({
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
Modal.createDialog(ErrorDialog, { Modal.createDialog(ErrorDialog, {
title: "Failed to get public room list", title: "Failed to get public room list",
description: "The server may be unavailable or overloaded", description: ((err && err.message) ? err.message : "The server may be unavailable or overloaded"),
}); });
}); });
}, },
@ -209,8 +209,8 @@ module.exports = React.createClass({
this.refreshRoomList(); this.refreshRoomList();
console.error("Failed to " + step + ": " + err); console.error("Failed to " + step + ": " + err);
Modal.createDialog(ErrorDialog, { Modal.createDialog(ErrorDialog, {
title: "Error", title: "Failed to " + step,
description: "Failed to " + step, description: ((err && err.message) ? err.message : "The server may be unavailable or overloaded"),
}); });
}); });
} }

View file

@ -456,8 +456,8 @@ var RoomSubList = React.createClass({
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
console.error("Failed to add tag " + self.props.tagName + " to room" + err); console.error("Failed to add tag " + self.props.tagName + " to room" + err);
Modal.createDialog(ErrorDialog, { Modal.createDialog(ErrorDialog, {
title: "Error", title: "Failed to add tag " + self.props.tagName + " to room",
description: "Failed to add tag " + self.props.tagName + " to room", description: ((err && err.message) ? err.message : "Operation failed"),
}); });
}); });
break; break;

View file

@ -71,7 +71,7 @@ module.exports = React.createClass({
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
Modal.createDialog(ErrorDialog, { Modal.createDialog(ErrorDialog, {
title: "Failed to remove tag " + tagNameOff + " from room", title: "Failed to remove tag " + tagNameOff + " from room",
description: err.toString() description: ((err && err.message) ? err.message : "Operation failed"),
}); });
}); });
} }
@ -88,7 +88,7 @@ module.exports = React.createClass({
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
Modal.createDialog(ErrorDialog, { Modal.createDialog(ErrorDialog, {
title: "Failed to add tag " + tagNameOn + " to room", title: "Failed to add tag " + tagNameOn + " to room",
description: err.toString() description: ((err && err.message) ? err.message : "Operation failed"),
}); });
}); });
} }
@ -149,7 +149,7 @@ module.exports = React.createClass({
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
Modal.createDialog(ErrorDialog, { Modal.createDialog(ErrorDialog, {
title: "Failed to set Direct Message status of room", title: "Failed to set Direct Message status of room",
description: err.toString() description: ((err && err.message) ? err.message : "Operation failed"),
}); });
}); });
}, },
@ -187,8 +187,8 @@ module.exports = React.createClass({
var errCode = err.errcode || "unknown error code"; var errCode = err.errcode || "unknown error code";
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
Modal.createDialog(ErrorDialog, { Modal.createDialog(ErrorDialog, {
title: "Error", title: `Failed to forget room (${errCode})`,
description: `Failed to forget room (${errCode})` description: ((err && err.message) ? err.message : "Operation failed"),
}); });
}); });

View file

@ -90,8 +90,8 @@ var roomTileSource = {
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
console.error("Failed to set direct chat tag " + err); console.error("Failed to set direct chat tag " + err);
Modal.createDialog(ErrorDialog, { Modal.createDialog(ErrorDialog, {
title: "Error", title: "Failed to set direct chat tag",
description: "Failed to set direct chat tag", description: ((err && err.message) ? err.message : "Operation failed"),
}); });
}); });
return; return;
@ -115,8 +115,8 @@ var roomTileSource = {
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
console.error("Failed to remove tag " + prevTag + " from room: " + err); console.error("Failed to remove tag " + prevTag + " from room: " + err);
Modal.createDialog(ErrorDialog, { Modal.createDialog(ErrorDialog, {
title: "Error", title: "Failed to remove tag " + prevTag + " from room",
description: "Failed to remove tag " + prevTag + " from room", description: ((err && err.message) ? err.message : "Operation failed"),
}); });
}); });
} }
@ -137,8 +137,8 @@ var roomTileSource = {
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
console.error("Failed to add tag " + newTag + " to room: " + err); console.error("Failed to add tag " + newTag + " to room: " + err);
Modal.createDialog(ErrorDialog, { Modal.createDialog(ErrorDialog, {
title: "Error", title: "Failed to add tag " + newTag + " to room",
description: "Failed to add tag " + newTag + " to room", description: ((err && err.message) ? err.message : "Operation failed"),
}); });
}); });
} }

View file

@ -240,8 +240,8 @@ module.exports = React.createClass({
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
console.error("Failed to change settings: " + error); console.error("Failed to change settings: " + error);
Modal.createDialog(ErrorDialog, { Modal.createDialog(ErrorDialog, {
title: "Error", title: "Failed to change settings",
description: "Failed to change settings", description: ((error && error.message) ? error.message : "Operation failed"),
onFinished: self._refreshFromServer onFinished: self._refreshFromServer
}); });
}); });
@ -310,8 +310,8 @@ module.exports = React.createClass({
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
console.error("Can't update user notification settings: " + error); console.error("Can't update user notification settings: " + error);
Modal.createDialog(ErrorDialog, { Modal.createDialog(ErrorDialog, {
title: "Error", title: "Can't update user notification settings",
description: "Can't update user notification settings", description: ((error && error.message) ? error.message : "Operation failed"),
onFinished: self._refreshFromServer onFinished: self._refreshFromServer
}); });
}); });
@ -352,8 +352,8 @@ module.exports = React.createClass({
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
console.error("Failed to update keywords: " + error); console.error("Failed to update keywords: " + error);
Modal.createDialog(ErrorDialog, { Modal.createDialog(ErrorDialog, {
title: "Error", title: "Failed to update keywords",
description: "Failed to update keywords", description: ((error && error.message) ? error.message : "Operation failed"),
onFinished: self._refreshFromServer onFinished: self._refreshFromServer
}); });
} }