Skip to content

Commit

Permalink
Merge pull request #258 from KIT-CMS/validation_error
Browse files Browse the repository at this point in the history
add error handeling for validation errors
  • Loading branch information
a-monsch authored Apr 12, 2024
2 parents 75911f5 + 63125c5 commit c886fd4
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion code_generation/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -697,9 +697,21 @@ def _validate_parameters(self) -> None:

required_parameters = {}
for scope in self.scopes:
log.debug(" Collecting required parameters for scope {}".format(scope))
required_parameters[scope] = set()
for producer in self.producers[scope]:
required_parameters[scope] |= producer.parameters[scope]
log.debug(" Collecting parameters for producer {}".format(producer))
try:
required_parameters[scope] |= producer.parameters[scope]
except KeyError:
log.error(
f"Producer {producer} is not correctly setup for scope {scope}"
)
raise ConfigurationError(
"Producer {} is not correctly setup for scope {}".format(
producer, scope
)
)
# now check, which parameters are set in the configuration, but not used by any producer
for scope in self.scopes:
log.info("------------------------------------")
Expand Down

0 comments on commit c886fd4

Please sign in to comment.