-
- Downloads
[FIX] web: make originalError the root of the error chain
Previously, when calling error handlers, we would give them a new error
created by the error service, as well as an `originalError` which is the
error that was caught by the error service. In some cases, this error is
part of an error chain, eg: errors that happen in the owl lifecycle are
wrapped in an `OwlError`, so that when an error occurs in a callback
passed to a lifecycle hook, the position where the hook was called to
register the offending callback is part of the stack trace.
In practice, most error handlers only care about the error that caused
the entire error chain (the root) when deciding whether they should
handle the error or not, eg: an RPCError should be handled by the rpc
error handler, regardless of whether it occured in an event handler or
in a component's willStart. It already reads the traceback to display on
the UncaughtError provided by the error service as this traceback
contains the entire error chain stack information and is annotated with
source maps by the error service.
This commit makes it so that the `originalError` passed to handlers is
now the root of the error chain, it also sets the `cause` of the
UncaughtError which is passed to handlers as the error that was caught
by the error service, so that if a handler needs to inspect the error
chain to know whether it can handle the error or not, it can still do
that.
related to OPW-3069633
closes odoo/odoo#106661
Signed-off-by:
Michaël Mattiello <mcm@odoo.com>
Showing
- addons/web/static/src/core/errors/error_dialogs.js 1 addition, 1 deletionaddons/web/static/src/core/errors/error_dialogs.js
- addons/web/static/src/core/errors/error_handlers.js 11 additions, 67 deletionsaddons/web/static/src/core/errors/error_handlers.js
- addons/web/static/src/core/errors/error_service.js 21 additions, 15 deletionsaddons/web/static/src/core/errors/error_service.js
- addons/web/static/src/legacy/legacy_rpc_error_handler.js 1 addition, 6 deletionsaddons/web/static/src/legacy/legacy_rpc_error_handler.js
- addons/web/static/tests/core/errors/error_service_tests.js 55 additions, 3 deletionsaddons/web/static/tests/core/errors/error_service_tests.js
Loading
Please register or sign in to comment