Add error message on JS or LESS blocking error

pull/1/head
yflory 4 years ago
parent b9d4f252eb
commit 753644f638

@ -260,6 +260,11 @@ button.primary:hover{
'<p id="cp-loading-message"></p>',
'</div>'
].join('');
window.CryptPad_loadingError = function (err) {
document.querySelector('.cp-loading-spinner-container').setAttribute('style', 'display:none;');
document.querySelector('#cp-loading-message').setAttribute('style', 'display:block;');
document.querySelector('#cp-loading-message').innerText = err;
};
return function () {
var intr;
var append = function () {

@ -167,7 +167,12 @@ define([
if (css) { return void loadSubmodulesAndInject(css, url, done, stack); }
console.debug('CACHE MISS ' + url);
((/\.less([\?\#].*)?$/.test(url)) ? loadLess : loadCSS)(url, function (err, css) {
if (!css) { return void console.error(err); }
if (!css) {
if (window.CryptPad_loadingError) {
window.CryptPad_loadingError('LESS: ' + (err && err.message));
}
return void console.error(err);
}
var output = fixAllURLs(css, url);
cachePut(url, output);
loadSubmodulesAndInject(output, url, done, stack);

@ -42,6 +42,9 @@ define([
console.error("Require.js threw a Script Error. This probably means you're missing a dependency for CryptPad.\nIt is recommended that the admin of this server runs `bower install && bower update` to get the latest code, then modify their cache version.\nBest of luck,\nThe CryptPad Developers");
return void console.log();
}
if (window.CryptPad_loadingError) {
window.CryptPad_loadingError(e);
}
throw e;
};

Loading…
Cancel
Save