Skip to content

Commit 405b17c

Browse files
committed
Check whether action handler has source in collect_actions
1 parent 2e1c962 commit 405b17c

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/finecode/config/collect_actions.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ def _collect_action_handler_configs_in_config(
4141
action_handlers_configs = config["tool"]["finecode"].get("action_handler", [])
4242
action_handler_config_by_source: dict[str, dict[str, Any]] = {}
4343
for handler_def in action_handlers_configs:
44-
# TODO: validate that source field exist?
44+
if "source" not in handler_def or not isinstance(handler_def['source'], str):
45+
raise config_models.ConfigurationError("Action handler definition expected to have a 'source' field(to identify handler) and it should be a string")
46+
4547
handler_config = handler_def.get("config", None)
4648
if handler_config is not None:
4749
action_handler_config_by_source[handler_def["source"]] = handler_config

0 commit comments

Comments
 (0)