Skip to content

Commit

Permalink
fix: handle ClientError in retry logic for translation service (#308)
Browse files Browse the repository at this point in the history
  • Loading branch information
vasiliadi authored Feb 15, 2025
1 parent 6c39e2d commit fcf8e26
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/translate.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from textwrap import dedent

from google.genai import types
from google.genai.errors import ServerError
from google.genai.errors import ClientError, ServerError
from tenacity import (
before_sleep_log,
retry,
Expand All @@ -21,7 +21,7 @@
stop=stop_after_attempt(3),
wait=wait_fixed(30),
retry=retry_if_exception_type(
(ServerError),
(ServerError, ClientError),
),
before_sleep=before_sleep_log(logger, log_level=logging.WARNING),
reraise=False,
Expand Down

0 comments on commit fcf8e26

Please sign in to comment.