feat(devgen/providers): improve error detection for rate‑limiting and quota exceeded responses
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.
This commit is contained in:
1 file changed
+9
-1
@@ -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(
|
||||
|
||||
Reference in new issue
Block a user