-
Notifications
You must be signed in to change notification settings - Fork 358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed Error handling of REST API calls. #490
Fixed Error handling of REST API calls. #490
Conversation
1d631db
to
04a2c53
Compare
@mkanoor Are you aware of this issue or how to test/validate this fix? |
} else { | ||
handleSuccess; | ||
} | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@h-kataria Can you leverage handleFailure
function in miqService
here?
Check how it's being used in the other controllers.
04a2c53
to
6f29c20
Compare
@AparnaKarve please review. |
@gmcculloug To test just the API error we might have to run without @bdunne 's changes |
@mkanoor i used ManageIQ/manageiq#14051 to mock data and help me recreate the issue. |
@h-kataria @gmcculloug |
@AparnaKarve please re-review. |
@h-kataria As we discussed, can you change function handleSuccess(response) {
$timeout(function () {
if (response.error) {
var msg = __(response.error.klass + ': ' + response.error.message);
miqService.miqFlash('error', msg);
miqService.sparkleOff();
} else {
$window.location.href = redirectURL + '&flash_msg=' + successMsg;
}
});
} I also recommend using |
21b5e96
to
65f56b9
Compare
@AparnaKarve made suggested changes, please re-review. |
@@ -124,7 +124,7 @@ ManageIQ.angular.app.service('miqService', ['$timeout', '$document', '$q', '$log | |||
|
|||
return serializedObj; | |||
}; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove this blank line? Since there are no real changes here, let's not include this JS in this PR at all.
@@ -6,18 +6,18 @@ ManageIQ.angular.app.service('postService', ["miqService", "$timeout", "$window" | |||
angular.toJson({ | |||
action: "edit", | |||
resource: updateObject | |||
})).then(handleSuccess, handleFailure); | |||
})).then(handleSuccess, miqService.handleFailure) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you change this to simply --
.then(handleSuccess)
No need for miqService.handleFailure
in .then
(Sorry, I should have specified that before)
And the same change below.
e56c059
to
b36de98
Compare
b36de98
to
66581fc
Compare
Checked commits h-kataria/manageiq-ui-classic@6f29c20~...66581fc with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 |
@AparnaKarve made suggested changes |
Thanks @h-kataria. |
@dclarizio can you please merge. |
@mkanoor @gmcculloug please test.