diff --git a/app/shared/responseHandlers.js b/app/shared/responseHandlers.js index 95b7e9c92..16bdc248a 100644 --- a/app/shared/responseHandlers.js +++ b/app/shared/responseHandlers.js @@ -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}); } diff --git a/app/shared/services.js b/app/shared/services.js index 3d4c53352..b715ebc1d 100644 --- a/app/shared/services.js +++ b/app/shared/services.js @@ -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),