Skip to content

Commit

Permalink
fix: check that time series file exists (#716)
Browse files Browse the repository at this point in the history
  • Loading branch information
markusrf authored Nov 27, 2024
1 parent 062f3f4 commit b2daf23
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/libecalc/presentation/yaml/domain/time_series_collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,17 @@ def __init__(self, time_series: list[YamlTimeSeriesCollection], resources: dict[
time_series_collections: dict[str, TimeSeriesCollection] = {}
errors: list[ModelValidationError] = []
for time_series_collection in time_series:
resource = resources[time_series_collection.file]
resource = resources.get(time_series_collection.file)
if resource is None:
errors.append(
ModelValidationError(
data=None,
location=Location(keys=[]),
message=f"There is no resource file '{time_series_collection.file}'",
file_context=None,
)
)
continue
try:
time_series_collections[time_series_collection.name] = TimeSeriesCollection.from_yaml(
resource=resource,
Expand Down

0 comments on commit b2daf23

Please sign in to comment.