From e710b457c3ecf7a1c1eab1457d8b442006ecd6c0 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Tue, 1 Oct 2024 15:38:22 -0300 Subject: [PATCH] chore: Refactor error handling in OutputParser for improved readability (#3985) Refactor: improve readability of error handling in OutputParser --- .../langflow/components/output_parsers/OutputParser.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/backend/base/langflow/components/output_parsers/OutputParser.py b/src/backend/base/langflow/components/output_parsers/OutputParser.py index ce32700a0..0dfa37273 100644 --- a/src/backend/base/langflow/components/output_parsers/OutputParser.py +++ b/src/backend/base/langflow/components/output_parsers/OutputParser.py @@ -34,11 +34,11 @@ class OutputParserComponent(Component): def build_parser(self) -> OutputParser: if self.parser_type == "CSV": return CommaSeparatedListOutputParser() - else: - raise ValueError("Unsupported or missing parser") + msg = "Unsupported or missing parser" + raise ValueError(msg) def format_instructions(self) -> Message: if self.parser_type == "CSV": return Message(text=CommaSeparatedListOutputParser().get_format_instructions()) - else: - raise ValueError("Unsupported or missing parser") + msg = "Unsupported or missing parser" + raise ValueError(msg)