summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorXavier Morel <xmo@odoo.com>2019-12-04 12:42:18 +0000
committerXavier Morel <xmo@odoo.com>2020-01-21 06:55:32 +0000
commit0198c3e05d4e1fe5b9cc61ae9b3e5c9a76e3528d (patch)
tree773a49ceb9208e9c44310081f57255de346d77b6 /addons
parent4a19e48e4ae865f952f9acc4d6697b069ddb0e77 (diff)
[IMP] core: reporting of browser logs / errors during setup
Sink handling of JS logging, exceptions and websocket timeouts so calls other than _wait_code_ok handle them somewhat properly: the issue fixed by odoo/odoo#41231 passed because it occurred during module loading, which happens during initial page loading (browser_js > navigate_to > _websocket_wait_event), which ignored logs (and exceptions though here it's a console.error log), and as a result reported no failure (and would simply miss that specific test as well as every test following it). Also since ChromeBrowser treats console.error as an exception, important messages should be logged atomically. Merge two consecutive console.error into a single one at the loading of modules so we don't just get an exception "error while loading foo.bar" without any of the useful details. That ChromeBrowser treats console.error as exception is also why the new method gets a flag (to suppress this behaviour): in the case of two console.error, upon encountering the first it's treated as an error so we try to take a screenshot, which goes through the messages in order to get the screenshot response, which encounters the second console.error, which gets treated as an exception, which hides the first error. Instead, screenshotting (and more generally _websocket_wait_id) should treat console.error as a regular logging call, probably. Also run JS tests in debug=assets for easier debugging (ha!) and improve formatting of exception object when receiving an exception: * if we can get a description on an `exception` remote object just print that, it's formatted to show the exception type, message & traceback * otherwise format the garbage that is an "ExceptionDetails" object
Diffstat (limited to 'addons')
-rw-r--r--addons/bus/static/src/js/crosstab_bus.js2
-rw-r--r--addons/web/static/src/js/boot.js3
2 files changed, 2 insertions, 3 deletions
diff --git a/addons/bus/static/src/js/crosstab_bus.js b/addons/bus/static/src/js/crosstab_bus.js
index 8f66a64b286..fc6a9c3d900 100644
--- a/addons/bus/static/src/js/crosstab_bus.js
+++ b/addons/bus/static/src/js/crosstab_bus.js
@@ -348,7 +348,7 @@ var CrossTabBus = Longpolling.extend({
*/
_onUnload: function () {
// unload peer
- var peers = this._callLocalStorage('getItem', 'peers', {});
+ var peers = this._callLocalStorage('getItem', 'peers') || {};
delete peers[this._id];
this._callLocalStorage('setItem', 'peers', peers);
diff --git a/addons/web/static/src/js/boot.js b/addons/web/static/src/js/boot.js
index 3313188eff1..621307720b7 100644
--- a/addons/web/static/src/js/boot.js
+++ b/addons/web/static/src/js/boot.js
@@ -261,8 +261,7 @@
jobs.splice(jobs.indexOf(job), 1);
} catch (e) {
job.error = e;
- console.error('Error while loading ' + job.name);
- console.error(e.stack);
+ console.error('Error while loading ' + job.name + ': '+ e.stack);
}
if (!job.error) {
Promise.resolve(jobExec).then(