mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-07-17 05:20:23 -07:00
feat(core): add HTTP 499 to retryable errors and map to RetryableQuotaError (#20432)
This commit is contained in:
@@ -81,7 +81,7 @@ describe('classifyGoogleError', () => {
|
||||
}
|
||||
});
|
||||
|
||||
it('should return original error if code is not 429 or 503', () => {
|
||||
it('should return original error if code is not 429, 499 or 503', () => {
|
||||
const apiError: GoogleApiError = {
|
||||
code: 500,
|
||||
message: 'Server error',
|
||||
@@ -95,6 +95,22 @@ describe('classifyGoogleError', () => {
|
||||
expect(result).not.toBeInstanceOf(RetryableQuotaError);
|
||||
});
|
||||
|
||||
it('should return RetryableQuotaError for 499 Client Closed Request', () => {
|
||||
const apiError: GoogleApiError = {
|
||||
code: 499,
|
||||
message: 'Client Closed Request',
|
||||
details: [],
|
||||
};
|
||||
vi.spyOn(errorParser, 'parseGoogleApiError').mockReturnValue(apiError);
|
||||
const originalError = new Error('Client Closed Request');
|
||||
const result = classifyGoogleError(originalError);
|
||||
expect(result).toBeInstanceOf(RetryableQuotaError);
|
||||
if (result instanceof RetryableQuotaError) {
|
||||
expect(result.cause).toBe(apiError);
|
||||
expect(result.message).toBe('Client Closed Request');
|
||||
}
|
||||
});
|
||||
|
||||
it('should return TerminalQuotaError for daily quota violations in QuotaFailure', () => {
|
||||
const apiError: GoogleApiError = {
|
||||
code: 429,
|
||||
|
||||
Reference in New Issue
Block a user