aboutsummaryrefslogtreecommitdiffstats
path: root/interface
diff options
context:
space:
mode:
authorAndrew Lewis <nerf@judo.za.org>2016-07-26 14:47:10 +0200
committerAndrew Lewis <nerf@judo.za.org>2016-07-26 14:56:08 +0200
commit5570afeb035045efb74b8f87dd4e7ec9bc753888 (patch)
treee6b20aded7c625c6b55e0c0114921fd8c8ba025e /interface
parenta3a2f3e1e222bbb6c113246ed00aeedc8298b45e (diff)
downloadrspamd-5570afeb035045efb74b8f87dd4e7ec9bc753888.tar.gz
rspamd-5570afeb035045efb74b8f87dd4e7ec9bc753888.zip
[WebUI] Friendly error messages for failed learns
Diffstat (limited to 'interface')
-rw-r--r--interface/js/rspamd.js16
1 files changed, 7 insertions, 9 deletions
diff --git a/interface/js/rspamd.js b/interface/js/rspamd.js
index 1aa96e6fa..be73bf368 100644
--- a/interface/js/rspamd.js
+++ b/interface/js/rspamd.js
@@ -737,16 +737,14 @@
alertMessage('alert-success', 'Data successfully uploaded');
}
},
- // error: function() {
- // alertMessage('alert-error', 'Cannot upload data');
- // },
- statusCode: {
- 404: function () {
- alertMessage('alert-error', 'Cannot upload data, no server found');
- },
- 503: function () {
- alertMessage('alert-error', 'Cannot tokenize message, no text data');
+ error: function (xhr, textStatus, errorThrown) {
+ try {
+ var json = $.parseJSON(xhr.responseText);
+ var errorMsg = $('<a>').text(json.error).html();
+ } catch(err) {
+ var errorMsg = $('<a>').text("Error: [" + textStatus + "] " + errorThrown).html();
}
+ alertMessage('alert-error', errorMsg);
}
});
}