[IMP] web: better error log when starting js modules

Before this commit, the module system logged module errors by displaying
the stack.  Fun fact: the stack in Chrome does display the error message
(which is why nobody complained too much about bad error messages), but
this is not true in firefox.

Also, and this is a bigger issue, when we serialize the error stack like
this, we prevent the browser to apply sourcemaps, if any. Which means
that errors in debug=assets are not easy to understand.

With this commit, we display the raw error, which means that in
debug=assets, this will be nicely formatted by the browser when displayed
in the console.
This commit is contained in:
Géry Debongnie
2021-02-25 14:29:27 +00:00
parent bb04da8f64
commit bdc27b74af
+2 -1
View File
@@ -261,7 +261,8 @@
jobs.splice(jobs.indexOf(job), 1);
} catch (e) {
job.error = e;
console.error('Error while loading ' + job.name + ': '+ e.stack);
console.error(e);
console.error(`Error while loading ${job.name}: ${e.message}`);
}
if (!job.error) {
Promise.resolve(jobExec).then(