From 5aaf2e86c2d8603887ddbd81cbaeb9751faf59d0 Mon Sep 17 00:00:00 2001 From: Samuel Degueldre Date: Wed, 15 Sep 2021 13:11:40 +0000 Subject: [PATCH] [IMP] mail: annotate rtc log traces for better traces in debug=assets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit closes odoo/odoo#76627 X-original-commit: bf5fa4ef5cf589927992156868afdc10f518725a Signed-off-by: Sébastien Theys (seb) --- addons/mail/static/src/models/rtc/rtc.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/mail/static/src/models/rtc/rtc.js b/addons/mail/static/src/models/rtc/rtc.js index 5c7348a75b8..64d164bd23b 100644 --- a/addons/mail/static/src/models/rtc/rtc.js +++ b/addons/mail/static/src/models/rtc/rtc.js @@ -1,6 +1,7 @@ /** @odoo-module **/ import { browser } from "@web/core/browser/browser"; +import { annotateTraceback } from "@web/core/errors/error_utils"; import { registerNewModel } from '@mail/model/model_core'; import { attr, one2many, one2one } from '@mail/model/model_field'; @@ -366,16 +367,17 @@ function factory(dependencies) { * @param {String} [param2.step] current step of the flow * @param {String} [param2.state] current state of the connection */ - _addLogEntry(token, entry, { step, state } = {}) { + async _addLogEntry(token, entry, { step, state } = {}) { if (!this.env.isDebug()) { return; } if (!(token in this.logs)) { this.logs[token] = { step: '', state: '', logs: [] }; } + const trace = await annotateTraceback(window.Error()); this.logs[token].logs.push({ event: `${window.moment().format('h:mm:ss')}: ${entry}`, - trace: window.Error().stack.split('\n').slice(1, 15), + trace: trace.split('\n'), }); if (step) { this.logs[token].step = step;