summaryrefslogtreecommitdiff
path: root/web-ui/app/js/helpers
diff options
context:
space:
mode:
authorDuda Dornelles <ddornell@thoughtworks.com>2015-02-18 13:17:30 -0200
committerDuda Dornelles <ddornell@thoughtworks.com>2015-02-18 13:40:49 -0200
commit4a8217744e1d1ca60d158c3497a09b92f857a7fd (patch)
tree3d3e52ca752567078abc27da4752d8d20a624984 /web-ui/app/js/helpers
parent45aa91442ad6f78b4cc99da77506058c13f6b98f (diff)
#294 - using server error message on ajax if message is provided
Diffstat (limited to 'web-ui/app/js/helpers')
-rw-r--r--web-ui/app/js/helpers/monitored_ajax.js4
1 files changed, 3 insertions, 1 deletions
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));