From 4a8217744e1d1ca60d158c3497a09b92f857a7fd Mon Sep 17 00:00:00 2001 From: Duda Dornelles Date: Wed, 18 Feb 2015 13:17:30 -0200 Subject: #294 - using server error message on ajax if message is provided --- web-ui/app/js/helpers/monitored_ajax.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'web-ui/app/js/helpers') diff --git a/web-ui/app/js/helpers/monitored_ajax.js b/web-ui/app/js/helpers/monitored_ajax.js index 0f851c7a..0068e10c 100644 --- a/web-ui/app/js/helpers/monitored_ajax.js +++ b/web-ui/app/js/helpers/monitored_ajax.js @@ -51,7 +51,9 @@ define(['page/events', 'views/i18n'], function (events, i18n) { return $.ajax(url, config).fail(function (xmlhttprequest, textstatus, message) { if (!config.skipErrorMessage) { - var msg = messages[textstatus] || 'unexpected problem while talking to server'; + var msg = (xmlhttprequest.responseJSON && xmlhttprequest.responseJSON.message) || + messages[textstatus] || + 'unexpected problem while talking to server'; on.trigger(document, events.ui.userAlerts.displayMessage, { message: i18n(msg) }); } }.bind(this)); -- cgit v1.2.3