Skip to content

Commit 3c20e16

Browse files
committed
fix: Improve error handling in summarizer module
- Improve error handling in summarizer.py - Provide specific error messages for different exceptions
1 parent 1c91b64 commit 3c20e16

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

transcribe_me/summarization/summarizer.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ def generate_summary(
4141
summary = openai_response.choices[0].message.content.strip()
4242
except openai.error.RateLimitError as e:
4343
print(f"{Fore.YELLOW}Rate limit reached, retrying in a bit...")
44-
raise e
44+
except e:
45+
print(f"{Fore.RED}Error: {e}")
4546
elif "anthropic" in platform:
4647
anthropic_client = anthropic.Anthropic(api_key=ANTHROPIC_API_KEY)
4748
try:
@@ -55,8 +56,8 @@ def generate_summary(
5556
summary = anthropic_response.content[0].text
5657
except anthropic.error.RateLimitError as e:
5758
print(f"{Fore.YELLOW}Rate limit reached, retrying in a bit...")
58-
raise e
59-
59+
except e:
60+
print(f"{Fore.RED}Error: {e}")
6061
return summary
6162

6263

0 commit comments

Comments
 (0)