beautify a tonne more errors

This commit is contained in:
Matthew Hodgson 2017-03-12 22:59:41 +00:00
parent 71e0780eee
commit 3aaf37df1a
11 changed files with 50 additions and 32 deletions

View file

@ -310,9 +310,10 @@ function _onAction(payload) {
placeCall(call); placeCall(call);
}, function(err) { }, function(err) {
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
console.error("Conference call failed: " + err);
Modal.createDialog(ErrorDialog, { Modal.createDialog(ErrorDialog, {
title: "Failed to set up conference call", title: "Failed to set up conference call",
description: "Conference call failed: " + err, description: "Conference call failed.",
}); });
}); });
} }

View file

@ -402,9 +402,10 @@ module.exports = React.createClass({
dis.dispatch({action: 'view_next_room'}); dis.dispatch({action: 'view_next_room'});
}, function(err) { }, function(err) {
modal.close(); modal.close();
console.error("Failed to leave room " + payload.room_id + " " + err);
Modal.createDialog(ErrorDialog, { Modal.createDialog(ErrorDialog, {
title: "Failed to leave room", title: "Failed to leave room",
description: err.toString() description: "Server may be unavailable, overloaded, or you hit a bug."
}); });
}); });
} }

View file

@ -930,9 +930,10 @@ module.exports = React.createClass({
file, this.state.room.roomId, MatrixClientPeg.get() file, this.state.room.roomId, MatrixClientPeg.get()
).done(undefined, function(error) { ).done(undefined, function(error) {
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
console.error("Failed to upload file " + file + " " + error);
Modal.createDialog(ErrorDialog, { Modal.createDialog(ErrorDialog, {
title: "Failed to upload file", title: "Failed to upload file",
description: error.toString() description: "Server may be unavailable, overloaded, or the file too big",
}); });
}); });
}, },
@ -1016,6 +1017,7 @@ module.exports = React.createClass({
}); });
}, function(error) { }, function(error) {
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
console.error("Search failed: " + error);
Modal.createDialog(ErrorDialog, { Modal.createDialog(ErrorDialog, {
title: "Search failed", title: "Search failed",
description: "Server may be unavailable, overloaded, or search timed out :(" description: "Server may be unavailable, overloaded, or search timed out :("

View file

@ -206,6 +206,7 @@ module.exports = React.createClass({
}); });
}, function(error) { }, function(error) {
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
console.error("Failed to load user settings: " + error);
Modal.createDialog(ErrorDialog, { Modal.createDialog(ErrorDialog, {
title: "Can't load user settings", title: "Can't load user settings",
description: "Server may be unavailable or overloaded", description: "Server may be unavailable or overloaded",
@ -246,10 +247,11 @@ module.exports = React.createClass({
self._refreshFromServer(); self._refreshFromServer();
}, function(err) { }, function(err) {
var errMsg = (typeof err === "string") ? err : (err.error || ""); var errMsg = (typeof err === "string") ? err : (err.error || "");
console.error("Failed to set avatar: " + err);
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
Modal.createDialog(ErrorDialog, { Modal.createDialog(ErrorDialog, {
title: "Error", title: "Error",
description: "Failed to set avatar. " + errMsg description: "Failed to set avatar."
}); });
}); });
}, },
@ -286,6 +288,7 @@ module.exports = React.createClass({
errMsg += ` (HTTP status ${err.httpStatus})`; errMsg += ` (HTTP status ${err.httpStatus})`;
} }
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
console.error("Failed to change password: " + errMsg);
Modal.createDialog(ErrorDialog, { Modal.createDialog(ErrorDialog, {
title: "Error", title: "Error",
description: errMsg description: errMsg
@ -337,9 +340,10 @@ module.exports = React.createClass({
}); });
}, (err) => { }, (err) => {
this.setState({email_add_pending: false}); this.setState({email_add_pending: false});
console.error("Unable to add email address " + email_address + " " + err);
Modal.createDialog(ErrorDialog, { Modal.createDialog(ErrorDialog, {
title: "Unable to add email address", title: "Error",
description: err.message description: "Unable to add email address"
}); });
}); });
ReactDOM.findDOMNode(this.refs.add_threepid_input).blur(); ReactDOM.findDOMNode(this.refs.add_threepid_input).blur();
@ -361,9 +365,10 @@ module.exports = React.createClass({
return this._refreshFromServer(); return this._refreshFromServer();
}).catch((err) => { }).catch((err) => {
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
console.error("Unable to remove contact information: " + err);
Modal.createDialog(ErrorDialog, { Modal.createDialog(ErrorDialog, {
title: "Unable to remove contact information", title: "Error",
description: err.toString(), description: "Unable to remove contact information",
}); });
}).done(); }).done();
} }
@ -401,9 +406,10 @@ module.exports = React.createClass({
}); });
} else { } else {
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
console.error("Unable to verify email address: " + err);
Modal.createDialog(ErrorDialog, { Modal.createDialog(ErrorDialog, {
title: "Unable to verify email address", title: "Error",
description: err.toString(), description: "Unable to verify email address",
}); });
} }
}); });

View file

@ -318,8 +318,8 @@ module.exports = React.createClass({
console.error(err.stack); console.error(err.stack);
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
Modal.createDialog(ErrorDialog, { Modal.createDialog(ErrorDialog, {
title: "Failure to invite", title: "Error",
description: err.toString() description: "Failed to invite",
}); });
return null; return null;
}) })
@ -331,8 +331,8 @@ module.exports = React.createClass({
console.error(err.stack); console.error(err.stack);
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
Modal.createDialog(ErrorDialog, { Modal.createDialog(ErrorDialog, {
title: "Failure to invite user", title: "Error",
description: err.toString() description: "Failed to invite user",
}); });
return null; return null;
}) })
@ -352,8 +352,8 @@ module.exports = React.createClass({
console.error(err.stack); console.error(err.stack);
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
Modal.createDialog(ErrorDialog, { Modal.createDialog(ErrorDialog, {
title: "Failure to invite", title: "Error",
description: err.toString() description: "Failed to invite",
}); });
return null; return null;
}) })

View file

@ -237,9 +237,10 @@ module.exports = WithMatrixClient(React.createClass({
console.log("Kick success"); console.log("Kick success");
}, function(err) { }, function(err) {
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
console.error("Kick error: " + err);
Modal.createDialog(ErrorDialog, { Modal.createDialog(ErrorDialog, {
title: "Kick error", title: "Error",
description: err.message description: "Failed to kick user",
}); });
} }
).finally(()=>{ ).finally(()=>{
@ -278,9 +279,10 @@ module.exports = WithMatrixClient(React.createClass({
console.log("Ban success"); console.log("Ban success");
}, function(err) { }, function(err) {
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
console.error("Ban error: " + err);
Modal.createDialog(ErrorDialog, { Modal.createDialog(ErrorDialog, {
title: "Ban error", title: "Error",
description: err.message, description: "Failed to ban user",
}); });
} }
).finally(()=>{ ).finally(()=>{
@ -327,9 +329,10 @@ module.exports = WithMatrixClient(React.createClass({
// get out of sync if we force setState here! // get out of sync if we force setState here!
console.log("Mute toggle success"); console.log("Mute toggle success");
}, function(err) { }, function(err) {
console.error("Mute error: " + err);
Modal.createDialog(ErrorDialog, { Modal.createDialog(ErrorDialog, {
title: "Mute error", title: "Error",
description: err.message description: "Failed to mute user",
}); });
} }
).finally(()=>{ ).finally(()=>{
@ -375,9 +378,10 @@ module.exports = WithMatrixClient(React.createClass({
description: "This action cannot be performed by a guest user. Please register to be able to do this." description: "This action cannot be performed by a guest user. Please register to be able to do this."
}); });
} else { } else {
console.error("Toggle moderator error:" + err);
Modal.createDialog(ErrorDialog, { Modal.createDialog(ErrorDialog, {
title: "Moderator toggle error", title: "Error",
description: err.message description: "Failed to toggle moderator status",
}); });
} }
} }
@ -395,9 +399,10 @@ module.exports = WithMatrixClient(React.createClass({
console.log("Power change success"); console.log("Power change success");
}, function(err) { }, function(err) {
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
console.error("Failed to change power level " + err);
Modal.createDialog(ErrorDialog, { Modal.createDialog(ErrorDialog, {
title: "Failure to change power level", title: "Error",
description: err.message description: "Failed to change power level",
}); });
} }
).finally(()=>{ ).finally(()=>{

View file

@ -509,7 +509,7 @@ export default class MessageComposerInput extends React.Component {
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
Modal.createDialog(ErrorDialog, { Modal.createDialog(ErrorDialog, {
title: "Server error", title: "Server error",
description: err.message description: "Server unavailable, overloaded, or something else went wrong.",
}); });
}); });
} }

View file

@ -311,7 +311,7 @@ export default React.createClass({
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
Modal.createDialog(ErrorDialog, { Modal.createDialog(ErrorDialog, {
title: "Server error", title: "Server error",
description: err.message description: "Server unavailable, overloaded, or something else went wrong.",
}); });
}); });
} }

View file

@ -115,9 +115,10 @@ module.exports = React.createClass({
changeAvatar.onFileSelected(ev).catch(function(err) { changeAvatar.onFileSelected(ev).catch(function(err) {
var errMsg = (typeof err === "string") ? err : (err.error || ""); var errMsg = (typeof err === "string") ? err : (err.error || "");
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
console.error("Failed to set avatar: " + errMsg);
Modal.createDialog(ErrorDialog, { Modal.createDialog(ErrorDialog, {
title: "Error", title: "Error",
description: "Failed to set avatar. " + errMsg description: "Failed to set avatar.",
}); });
}).done(); }).done();
}, },

View file

@ -54,9 +54,10 @@ const BannedUser = React.createClass({
this.props.member.roomId, this.props.member.userId, this.props.member.roomId, this.props.member.userId,
).catch((err) => { ).catch((err) => {
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
console.error("Failed to unban: " + err);
Modal.createDialog(ErrorDialog, { Modal.createDialog(ErrorDialog, {
title: "Failed to unban", title: "Error",
description: err.message, description: "Failed to unban",
}); });
}).done(); }).done();
}, },

View file

@ -102,9 +102,10 @@ function createRoom(opts) {
}); });
return roomId; return roomId;
}, function(err) { }, function(err) {
console.error("Failed to create room " + roomId + " " + err);
Modal.createDialog(ErrorDialog, { Modal.createDialog(ErrorDialog, {
title: "Failure to create room", title: "Failure to create room",
description: err.toString() description: "Server may be unavailable, overloaded, or you hit a bug.",
}); });
return null; return null;
}); });