🔨 refactor(custom_component.py): read build method

This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-08-04 08:33:39 -03:00
commit 2c6b88f4f9
2 changed files with 8 additions and 1 deletions

View file

@ -189,3 +189,6 @@ class CustomComponent(Component, extra=Extra.allow):
if not flow:
raise ValueError(f"Flow {flow_name or flow_id} not found")
return self.load_flow(flow.id, tweaks)
def build(self, *args: Any, **kwargs: Any) -> Any:
raise NotImplementedError

View file

@ -331,6 +331,7 @@ def build_valid_menu(valid_components):
valid_menu[menu_name] = {}
for component in menu_item["components"]:
logger.debug(f"Building component: {component}")
try:
component_name = component["name"]
component_code = component["code"]
@ -346,7 +347,10 @@ def build_valid_menu(valid_components):
valid_menu[menu_name][component_name] = component_template
except Exception as exc:
logger.error(f"Error while building custom component: {exc}")
logger.error(f"Error loading Component: {component}")
logger.exception(
f"Error while building custom component {component_output_types}: {exc}"
)
return valid_menu