From bdc27b74af409d90b83bf87fe69a90a7e4335685 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Wed, 24 Feb 2021 13:37:33 +0000 Subject: [PATCH] [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. --- addons/web/static/src/js/boot.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/js/boot.js b/addons/web/static/src/js/boot.js index 621307720b7..85463e6c371 100644 --- a/addons/web/static/src/js/boot.js +++ b/addons/web/static/src/js/boot.js @@ -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(