[IMP] app: throw error when static components key is missing in parent

This commit improves the error message that's thrown when a static
component definition is missing, as outlined in issue #1286.
This commit is contained in:
tom hunkapiller
2022-10-29 14:12:49 -05:00
committed by Sam Degueldre
parent 620e41daa1
commit 3d49daedcd
3 changed files with 39 additions and 1 deletions
+7 -1
View File
@@ -151,7 +151,13 @@ export class App<
} else {
// new component
if (isStatic) {
C = parent.constructor.components[name as any];
const components = parent.constructor.components;
if (!components) {
throw new OwlError(
`Cannot find the definition of component "${name}", missing static components key in parent`
);
}
C = components[name as any];
if (!C) {
throw new OwlError(`Cannot find the definition of component "${name}"`);
} else if (!(C.prototype instanceof Component)) {