Skip to content

Commit

Permalink
improve error reporting in support generate-schema
Browse files Browse the repository at this point in the history
  • Loading branch information
gilesknap committed Jun 24, 2024
1 parent 4d0e369 commit e7f830f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/ibek/entity_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())

Expand Down

0 comments on commit e7f830f

Please sign in to comment.