🐛 fix(types.py): add error handling when building custom components to prevent crashes and log the error message
This commit is contained in:
parent
eb94b957b5
commit
aa387f89b3
1 changed files with 11 additions and 8 deletions
|
|
@ -261,6 +261,7 @@ def build_langchain_custom_component_list_from_path(path: str):
|
||||||
menu[menu_name] = {}
|
menu[menu_name] = {}
|
||||||
|
|
||||||
for component in menu_item["components"]:
|
for component in menu_item["components"]:
|
||||||
|
try:
|
||||||
component_name = component["name"]
|
component_name = component["name"]
|
||||||
component_code = component["code"]
|
component_code = component["code"]
|
||||||
|
|
||||||
|
|
@ -271,5 +272,7 @@ def build_langchain_custom_component_list_from_path(path: str):
|
||||||
)
|
)
|
||||||
|
|
||||||
menu[menu_name][component_name] = component_template
|
menu[menu_name][component_name] = component_template
|
||||||
|
except Exception as exc:
|
||||||
|
logger.error(f"Error while building custom component: {exc}")
|
||||||
|
|
||||||
return menu
|
return menu
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue