From: Alexander Moisseev Date: Tue, 11 Sep 2018 17:31:27 +0000 (+0300) Subject: [WebUI] Notify user on module loading failure X-Git-Tag: 1.8.0~132^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fpull%2F2483%2Fhead;p=rspamd.git [WebUI] Notify user on module loading failure --- diff --git a/interface/css/rspamd.css b/interface/css/rspamd.css index 0628a25bc..14bb4e669 100644 --- a/interface/css/rspamd.css +++ b/interface/css/rspamd.css @@ -526,6 +526,10 @@ td.maps-cell { } /* Some spacing tweaks */ +.notification-area div > button:not(.close) { + margin-right: 9px; +} + #learning p > button { margin-top: 10px; } diff --git a/interface/js/main.js b/interface/js/main.js index 5ed33137d..db9c52942 100644 --- a/interface/js/main.js +++ b/interface/js/main.js @@ -32,6 +32,21 @@ define("d3.global", ["d3"], function (d3global) { // eslint-disable-line strict d3 = d3global; }); +// Notify user on module loading failure +requirejs.onError = function (e) { + "use strict"; + document.getElementsByClassName("notification-area")[0].innerHTML = + "
" + + "Module loading error: " + e.requireType + ", module: " + e.requireModules + "" + + "" + + "
"; + throw e; +}; + // Load main UI require(["app/rspamd"], function (rspamd) {