Skip to content

Commit

Permalink
Fix the API error message conditional and display flash message
Browse files Browse the repository at this point in the history
  • Loading branch information
AparnaKarve committed Mar 24, 2017
1 parent 18ef11c commit 21f07ac
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions 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,10 @@ ManageIQ.angular.app.service('miqService', ['$timeout', '$document', '$q', funct
this.handleFailure = function(e) {
miqSparkleOff();

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

return $q.reject(e);
Expand Down

0 comments on commit 21f07ac

Please sign in to comment.