Skip to content

Commit

Permalink
Merge pull request #684 from mesosphere/fix/3457-catch-errors
Browse files Browse the repository at this point in the history
Ensure API errors with unknown status or missing data are caught
  • Loading branch information
aldipower committed Mar 10, 2016
2 parents a31fbdc + 0ec46e5 commit 643d117
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
- \#3233 - Cannot remove a constraint
- \#3159 - Show args in configuration tab
- \#3430 - Uncaught TypeError when creating an empty application
- \#3457 - Ensure unknown API errors are caught

## 0.15.6 - 2016-02-23
- \#3192 - Adapt default Mem/CPU settings
Expand Down
2 changes: 1 addition & 1 deletion src/js/components/modals/GroupModalComponent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ var GroupModalComponent = React.createClass({
this.onCreateGroup();
} else {
let generalError = "Error creating group or invalid group name supplied";
if (data.message != null) {
if (data != null && data.message != null) {
generalError = data.message;
}
if (status === 409) {
Expand Down
13 changes: 10 additions & 3 deletions src/js/mixins/AppActionsHandlerMixin.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,16 @@ var bindOneTimeEvents = function (store, resolverEvents, handlers) {
};

var callErrorDialog = function (settings) {
var message = Messages[settings.statusCode] ||
settings.errorMessage.message ||
settings.errorMessage;
var {statusCode, errorMessage} = settings;
var message = "Unknown error.";

if (statusCode != null && Messages[statusCode] != null) {
message = Messages[statusCode];
} else if (errorMessage != null) {
message = errorMessage.message != null
? errorMessage.message
: errorMessage;
}

DialogActions.alert({
message: `${settings.messagePrefix}${message}`,
Expand Down

0 comments on commit 643d117

Please sign in to comment.