mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[FIX] lifecyle_hooks: correctly wrap errors in async code
Before this commit, wrapping an error occurring in async code would result in an unhandledpromise exception, because we created another promise, that would be rejected and that we didn't catch.
This commit is contained in:
committed by
Géry Debongnie
parent
d1118455aa
commit
30bc605c84
@@ -15,7 +15,7 @@ function wrapError(fn: (...args: any[]) => any, hookName: string) {
|
||||
if (hookName === "onWillStart" || hookName === "onWillUpdateProps") {
|
||||
const fiber = node.fiber;
|
||||
Promise.race([
|
||||
result,
|
||||
result.catch(() => {}),
|
||||
new Promise((resolve) => setTimeout(() => resolve(TIMEOUT), 3000)),
|
||||
]).then((res) => {
|
||||
if (res === TIMEOUT && node.fiber === fiber) {
|
||||
|
||||
Reference in New Issue
Block a user