From 78b16fb4bac326a6897b6fa4341e0568b26dc72c Mon Sep 17 00:00:00 2001 From: Alexander Moisseev Date: Tue, 11 Sep 2018 20:31:27 +0300 Subject: [PATCH] [WebUI] Notify user on module loading failure --- interface/css/rspamd.css | 4 ++++ interface/js/main.js | 15 +++++++++++++++ 2 files changed, 19 insertions(+) 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) { -- 2.39.5