mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-12 15:10:59 -07:00
36 lines
770 B
TypeScript
36 lines
770 B
TypeScript
/**
|
|
* @license
|
|
* Copyright 2025 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
import type { StructuredError } from '../core/turn.js';
|
|
|
|
export interface ApiError {
|
|
error: {
|
|
code: number;
|
|
message: string;
|
|
status: string;
|
|
details: unknown[];
|
|
};
|
|
}
|
|
|
|
export function isApiError(error: unknown): error is ApiError {
|
|
return (
|
|
typeof error === 'object' &&
|
|
error !== null &&
|
|
'error' in error &&
|
|
typeof (error as ApiError).error === 'object' &&
|
|
'message' in (error as ApiError).error
|
|
);
|
|
}
|
|
|
|
export function isStructuredError(error: unknown): error is StructuredError {
|
|
return (
|
|
typeof error === 'object' &&
|
|
error !== null &&
|
|
'message' in error &&
|
|
typeof (error as StructuredError).message === 'string'
|
|
);
|
|
}
|