mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[FIX] component: error handling in class inheritance
Before this commit, class inheritance when using the onError hook was unclear nay wrong. After this commit, error handlers are called from the bottom up in the inheritance hierarchy. If a handler doesn't rethrow the error, the handling stops there and no other handler is called. If a handler does rethrow, the handlers declared in a parent class are executed.
This commit is contained in:
committed by
Géry Debongnie
parent
60b8817ac0
commit
247200194f
@@ -768,6 +768,66 @@ exports[`can catch errors error in mounted on a component with a sibling (proper
|
||||
}"
|
||||
`;
|
||||
|
||||
exports[`can catch errors onError in class inheritance is called if rethrown 1`] = `
|
||||
"function anonymous(bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
|
||||
|
||||
let block1 = createBlock(\`<div><block-child-0/><block-child-1/></div>\`);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
let b2,b3;
|
||||
if (!ctx['state'].error) {
|
||||
b2 = text(this.will.crash);
|
||||
} else {
|
||||
b3 = text(ctx['state'].error);
|
||||
}
|
||||
return block1([], [b2, b3]);
|
||||
}
|
||||
}"
|
||||
`;
|
||||
|
||||
exports[`can catch errors onError in class inheritance is called if rethrown 2`] = `
|
||||
"function anonymous(bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
return component(\`Concrete\`, {}, key + \`__1\`, node, ctx);
|
||||
}
|
||||
}"
|
||||
`;
|
||||
|
||||
exports[`can catch errors onError in class inheritance is not called if no rethrown 1`] = `
|
||||
"function anonymous(bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
|
||||
|
||||
let block1 = createBlock(\`<div><block-child-0/><block-child-1/></div>\`);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
let b2,b3;
|
||||
if (!ctx['state'].error) {
|
||||
b2 = text(this.will.crash);
|
||||
} else {
|
||||
b3 = text(ctx['state'].error);
|
||||
}
|
||||
return block1([], [b2, b3]);
|
||||
}
|
||||
}"
|
||||
`;
|
||||
|
||||
exports[`can catch errors onError in class inheritance is not called if no rethrown 2`] = `
|
||||
"function anonymous(bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
return component(\`Concrete\`, {}, key + \`__1\`, node, ctx);
|
||||
}
|
||||
}"
|
||||
`;
|
||||
|
||||
exports[`errors and promises a rendering error in a sub component will reject the mount promise 1`] = `
|
||||
"function anonymous(bdom, helpers
|
||||
) {
|
||||
|
||||
Reference in New Issue
Block a user