mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-19 02:20:42 -07:00
26 lines
606 B
TypeScript
26 lines
606 B
TypeScript
|
|
/**
|
||
|
|
* @license
|
||
|
|
* Copyright 2025 Google LLC
|
||
|
|
* SPDX-License-Identifier: Apache-2.0
|
||
|
|
*/
|
||
|
|
|
||
|
|
import {
|
||
|
|
TerminalQuotaError,
|
||
|
|
RetryableQuotaError,
|
||
|
|
} from '../utils/googleQuotaErrors.js';
|
||
|
|
import { ModelNotFoundError } from '../utils/httpErrors.js';
|
||
|
|
import type { FailureKind } from './modelPolicy.js';
|
||
|
|
|
||
|
|
export function classifyFailureKind(error: unknown): FailureKind {
|
||
|
|
if (error instanceof TerminalQuotaError) {
|
||
|
|
return 'terminal';
|
||
|
|
}
|
||
|
|
if (error instanceof RetryableQuotaError) {
|
||
|
|
return 'transient';
|
||
|
|
}
|
||
|
|
if (error instanceof ModelNotFoundError) {
|
||
|
|
return 'not_found';
|
||
|
|
}
|
||
|
|
return 'unknown';
|
||
|
|
}
|