show (caught) exceptions during import now as error for easier spotting

console.error instead of console.log
This commit is contained in:
Ralf Becker 2021-06-14 15:22:16 +02:00
parent 829defa0c1
commit 8432cca3ea
2 changed files with 5 additions and 6 deletions

View File

@ -202,7 +202,7 @@ window.app = {classes: {}};
document.head.appendChild(script); document.head.appendChild(script);
}) })
// catch and display, but not stop execution // catch and display, but not stop execution
.catch((err) => { console.log(src+":\n\n"+err.message)}); .catch((err) => { console.error(src+": "+err.message)});
})); }));
} }
@ -215,10 +215,10 @@ window.app = {classes: {}};
window.egw_LAB = window.egw_ready = window.egw_LAB = window.egw_ready =
legacy_js_import(include.filter((src) => src.match(legacy_js_regexp) !== null), window.egw_webserverUrl) legacy_js_import(include.filter((src) => src.match(legacy_js_regexp) !== null), window.egw_webserverUrl)
.then(Promise.all(egw_modules.map(mod => import(window.egw_webserverUrl+'/api/js/jsapi/'+mod+'.js') .then(Promise.all(egw_modules.map(mod => import(window.egw_webserverUrl+'/api/js/jsapi/'+mod+'.js')
.catch((err) => {console.log(rel_src+":\n\n"+err.message)})))) .catch((err) => {console.error(rel_src+": "+err.message)}))))
.then(() => Promise.all(include.filter((src) => src.match(legacy_js_regexp) === null) //.reverse() .then(() => Promise.all(include.filter((src) => src.match(legacy_js_regexp) === null) //.reverse()
.map(rel_src => import(window.egw_webserverUrl+'/'+rel_src) .map(rel_src => import(window.egw_webserverUrl+'/'+rel_src)
.catch((err) => {console.log(rel_src+":\n\n"+err.message)}) .catch((err) => {console.error(rel_src+": "+err.message)})
))).then(() => ))).then(() =>
{ {
// We need to override the globalEval to mitigate potential execution of // We need to override the globalEval to mitigate potential execution of

View File

@ -7,7 +7,6 @@
* @link http://www.egroupware.org * @link http://www.egroupware.org
* @author Andreas Stöckel (as AT stylite.de) * @author Andreas Stöckel (as AT stylite.de)
* @author Ralf Becker <RalfBecker@outdoor-training.de> * @author Ralf Becker <RalfBecker@outdoor-training.de>
* @version $Id$
*/ */
/*egw:uses /*egw:uses
@ -164,7 +163,7 @@ egw.extend('files', egw.MODULE_WND_LOCAL, function(_app, _wnd)
const src = _jsFiles[0]; const src = _jsFiles[0];
promise = import(_prefix ? _prefix+src : src) promise = import(_prefix ? _prefix+src : src)
.catch((err) => { .catch((err) => {
console.log(src+":\n\n"+err.message); console.error(src+": "+err.message);
}); });
} }
else else
@ -172,7 +171,7 @@ egw.extend('files', egw.MODULE_WND_LOCAL, function(_app, _wnd)
promise = Promise.all(_jsFiles.map((src) => { promise = Promise.all(_jsFiles.map((src) => {
import(_prefix ? _prefix+src : src) import(_prefix ? _prefix+src : src)
.catch((err) => { .catch((err) => {
console.log(src+":\n\n"+err.message); console.error(src+": "+err.message);
}) })
})); }));
} }