🐛 fix(types.py): fix indentation and remove duplicate docstring to improve code readability

🔥 chore(types.py): remove unused variable 'e' and improve exception handling by adding 'from exc' to preserve original traceback
This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-09-18 10:39:29 -03:00
commit 6500d793d1

View file

@ -289,8 +289,8 @@ def add_base_classes(frontend_node, return_types: List[str]):
def build_langchain_template_custom_component(custom_component: CustomComponent): def build_langchain_template_custom_component(custom_component: CustomComponent):
"""Build a custom component template for the langchain"""
try: try:
"""Build a custom component template for the langchain"""
logger.debug("Building custom component template") logger.debug("Building custom component template")
frontend_node = build_frontend_node(custom_component) frontend_node = build_frontend_node(custom_component)
@ -316,7 +316,7 @@ def build_langchain_template_custom_component(custom_component: CustomComponent)
) )
logger.debug("Added base classes") logger.debug("Added base classes")
return frontend_node return frontend_node
except Exception as e: except Exception as exc:
raise HTTPException( raise HTTPException(
status_code=400, status_code=400,
detail={ detail={
@ -325,7 +325,7 @@ def build_langchain_template_custom_component(custom_component: CustomComponent)
), ),
"traceback": traceback.format_exc(), "traceback": traceback.format_exc(),
}, },
) ) from exc
def load_files_from_path(path: str): def load_files_from_path(path: str):