Browse Source

Merge pull request #756 from fatalbanana/webui

[WebUI] Friendly error messages for failed learns
pull/762/head
Vsevolod Stakhov 9 years ago
committed by GitHub
parent
commit
f28ccc4b9f
  1. 16
      interface/js/rspamd.js

16
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);
}
});
}

Loading…
Cancel
Save