diff --git a/src/ibek/entity_factory.py b/src/ibek/entity_factory.py index 03e87360..5a3ed697 100644 --- a/src/ibek/entity_factory.py +++ b/src/ibek/entity_factory.py @@ -40,19 +40,19 @@ def make_entity_models(self, entity_model_yaml: List[Path]) -> List[Type[Entity] from their EntityModel entries """ - for entity_model in entity_model_yaml: - support_dict = YAML(typ="safe").load(entity_model) + try: + for entity_model in entity_model_yaml: + support_dict = YAML(typ="safe").load(entity_model) - try: Support.model_validate(support_dict) # deserialize the support module yaml file support = Support(**support_dict) # make Entity classes described in the support module yaml file self._make_entity_models(support) - except ValidationError: - print(f"PYDANTIC VALIDATION ERROR IN {entity_model}") - raise + except Exception: + print(f"VALIDATION ERROR READING {entity_model}") + raise return list(self._entity_models.values())