From 3fa51848bead318f1094d0600bcf3edf11d8406c Mon Sep 17 00:00:00 2001 From: F4ria Date: Thu, 28 Dec 2023 11:21:31 +0800 Subject: [PATCH] fix: replace exception raise with user-friendly message --- handlers/gemini.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/handlers/gemini.py b/handlers/gemini.py index 27cdf25..2872bb8 100644 --- a/handlers/gemini.py +++ b/handlers/gemini.py @@ -172,7 +172,12 @@ def gemini_handler(message: Message, bot: TeleBot) -> None: gemini_reply_text = match.group(1) gemini_reply_text = re.sub(r"\\n", "\n", gemini_reply_text) else: - raise e + print("No meaningful text was extracted from the exception.") + bot.reply_to( + message, + "Google gemini encountered an error while generating an answer. Please check the log.", + ) + return try: bot.reply_to(