mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-21 02:24:09 -07:00
Feat/retry fetch notifications (#21813)
This commit is contained in:
@@ -100,6 +100,7 @@ function getNetworkErrorCode(error: unknown): string | undefined {
|
||||
}
|
||||
|
||||
const FETCH_FAILED_MESSAGE = 'fetch failed';
|
||||
const INCOMPLETE_JSON_MESSAGE = 'incomplete json segment';
|
||||
|
||||
/**
|
||||
* Default predicate function to determine if a retry should be attempted.
|
||||
@@ -119,8 +120,12 @@ export function isRetryableError(
|
||||
}
|
||||
|
||||
if (retryFetchErrors && error instanceof Error) {
|
||||
// Check for generic fetch failed message (case-insensitive)
|
||||
if (error.message.toLowerCase().includes(FETCH_FAILED_MESSAGE)) {
|
||||
const lowerMessage = error.message.toLowerCase();
|
||||
// Check for generic fetch failed message or incomplete JSON segment (common stream error)
|
||||
if (
|
||||
lowerMessage.includes(FETCH_FAILED_MESSAGE) ||
|
||||
lowerMessage.includes(INCOMPLETE_JSON_MESSAGE)
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user