Skip to content

Commit

Permalink
Merge pull request #805 from AparnaKarve/fix_api_error_flash_msg
Browse files Browse the repository at this point in the history
Fix API error object code and display a flash error message
  • Loading branch information
himdel authored Mar 27, 2017
2 parents 29a5f7a + 52fc752 commit 31bd639
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/assets/javascripts/services/miq_service.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ ManageIQ.angular.app.service('miqService', ['$timeout', '$document', '$q', funct
$(outerMost).append(outerBox);
$(outerMost).appendTo($("#flash_msg_div"));
};
var miqFlash = this.miqFlash;

this.miqFlashClear = function() {
$('#flash_msg_div').text("");
Expand Down Expand Up @@ -128,8 +129,12 @@ ManageIQ.angular.app.service('miqService', ['$timeout', '$document', '$q', funct
this.handleFailure = function(e) {
miqSparkleOff();

if (e.message) {
if (angular.isDefined(e.error) && angular.isDefined(e.error.message)) {
console.error(e.error.message);
miqFlash('error', e.error.message);
} else if (e.message) {
console.error(e.message);
miqFlash('error', e.message);
}

return $q.reject(e);
Expand Down

0 comments on commit 31bd639

Please sign in to comment.