Merge pull request #204 from cloud-inovasi/fix193-image-error-message

fix(image): support array in Messages.error
pull/205/head
Anthony Lapenna 8 years ago committed by GitHub
commit 1cd620a45e

@ -50,8 +50,8 @@ function genericHandler(data) {
// This handler returns the original array on success or a newly created array containing
// only one JSON object with the field message filled with the error message on failure.
function deleteImageHandler(data) {
var response = [];
// A string is returned on failure (Docker < 1.12)
var response = [];
if (!isJSON(data)) {
response.push({message: data});
}

@ -207,12 +207,13 @@ angular.module('portainer.services', ['ngResource', 'ngSanitize'])
});
},
error: function (title, e, fallbackText) {
console.log(JSON.stringify(e, null, 4));
var msg = fallbackText;
if (e.data && e.data.message) {
msg = e.data.message;
} else if (e.message) {
msg = e.message;
} else if (e.data.length > 0 && e.data[0].message) {
msg = e.data[0].message;
}
$.gritter.add({
title: $sanitize(title),

Loading…
Cancel
Save