Skip to content

Commit

Permalink
add error handeling for validation errors
Browse files Browse the repository at this point in the history
  • Loading branch information
harrypuuter committed Apr 11, 2024
1 parent 8a584a9 commit a146aca
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 a146aca

Please sign in to comment.