From 1b36c3f2d798ebdd35442c9ff06ac338901ab9b6 Mon Sep 17 00:00:00 2001 From: S4NKALP Date: Fri, 6 Mar 2026 19:43:16 +0545 Subject: [PATCH] =?UTF-8?q?feat(devgen/providers):=20improve=20error=20det?= =?UTF-8?q?ection=20for=20rate=E2=80=91limiting=20and=20quota=20exceeded?= =?UTF-8?q?=20responses?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Enhancements: - Extend error message parsing to capture additional throttling indicators such as "RESOURCE_EXHAUSTED", "QUOTA_EXCEEDED", and "THROTTLED". - Refactor the conditional logic for better readability and maintainability. - Keep existing retry behavior while increasing resilience to API rate‑limit errors. --- devgen/providers/gemini.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/devgen/providers/gemini.py b/devgen/providers/gemini.py index f712449..11fef68 100644 --- a/devgen/providers/gemini.py +++ b/devgen/providers/gemini.py @@ -38,7 +38,15 @@ class GeminiProvider: except Exception as e: error_msg = str(e).upper() # Check for 429 or ResourceExhausted in common error formats - if any(x in error_msg for x in ["429", "RESOURCE_EXHAUSTED", "QUOTA_EXCEEDED", "THROTTLED"]): + if any( + x in error_msg + for x in [ + "429", + "RESOURCE_EXHAUSTED", + "QUOTA_EXCEEDED", + "THROTTLED", + ] + ): if attempt < max_retries: delay = base_delay * (2**attempt) print(