From 260a85de2fa1ca195aad24ef1a768c653f47ebb5 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 14 Feb 2024 10:31:12 -0300 Subject: [PATCH] Fix invalid emoji error handling --- .../interface/custom/custom_component/component.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/backend/langflow/interface/custom/custom_component/component.py b/src/backend/langflow/interface/custom/custom_component/component.py index e2d84ed70..fc479e068 100644 --- a/src/backend/langflow/interface/custom/custom_component/component.py +++ b/src/backend/langflow/interface/custom/custom_component/component.py @@ -6,6 +6,7 @@ from typing import Any, ClassVar, Optional import emoji from cachetools import TTLCache, cachedmethod from fastapi import HTTPException + from langflow.interface.custom.code_parser import CodeParser from langflow.utils import validate @@ -20,7 +21,9 @@ class ComponentFunctionEntrypointNameNullError(HTTPException): class Component: ERROR_CODE_NULL: ClassVar[str] = "Python code must be provided." - ERROR_FUNCTION_ENTRYPOINT_NAME_NULL: ClassVar[str] = "The name of the entrypoint function must be provided." + ERROR_FUNCTION_ENTRYPOINT_NAME_NULL: ClassVar[str] = ( + "The name of the entrypoint function must be provided." + ) code: Optional[str] = None _function_entrypoint_name: str = "build" @@ -100,7 +103,8 @@ class Component: emoji_value = emoji.emojize(value, variant="emoji_type") if value == emoji_value: - raise ValueError(f"Invalid emoji. {value} is not a valid emoji.") + warnings.warn(f"Invalid emoji. {value} is not a valid emoji.") + return value return emoji_value def build(self, *args: Any, **kwargs: Any) -> Any: