mirror of
https://github.com/strapi/strapi.git
synced 2025-08-07 08:16:35 +00:00
better error handling for missing model error (#8328)
* Ammending commit Signed-off-by: Thomas Chezieres <tchezieres@MacBook-Pro.lan> * ammending last commit Signed-off-by: Thomas Chezieres <tchezieres@MacBook-Pro.lan> Co-authored-by: Thomas Chezieres <tchezieres@MacBook-Pro.lan> Co-authored-by: Alexandre BODIN <alexandrebodin@users.noreply.github.com>
This commit is contained in:
parent
1186d6a2ec
commit
2f97ff1f93
@ -75,6 +75,13 @@ module.exports = {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else if (_.has(attribute, 'via') && _.has(attribute, 'collection')) {
|
} else if (_.has(attribute, 'via') && _.has(attribute, 'collection')) {
|
||||||
|
if (!_.has(models, attribute.collection)) {
|
||||||
|
throw new Error(
|
||||||
|
`The collection \`${_.upperFirst(
|
||||||
|
attribute.collection
|
||||||
|
)}\` is missing from the ${attribute.plugin ? '(plugin - ' + attribute.plugin + ')' : ''} models`
|
||||||
|
);
|
||||||
|
}
|
||||||
const relatedAttribute = models[attribute.collection].attributes[attribute.via];
|
const relatedAttribute = models[attribute.collection].attributes[attribute.via];
|
||||||
|
|
||||||
if (!relatedAttribute) {
|
if (!relatedAttribute) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user