From 0abd2a644e947b7794dd68615d5d3d1553b0b5fd Mon Sep 17 00:00:00 2001 From: Tommaso Sciortino Date: Mon, 23 Jun 2025 18:37:41 -0700 Subject: Improve Auth error messaging (#1358) --- packages/cli/src/ui/components/AuthDialog.tsx | 2 +- packages/cli/src/ui/hooks/useAuthCommand.ts | 2 +- packages/cli/src/ui/hooks/useGeminiStream.ts | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'packages/cli') diff --git a/packages/cli/src/ui/components/AuthDialog.tsx b/packages/cli/src/ui/components/AuthDialog.tsx index c0e5d4f8..ba19df70 100644 --- a/packages/cli/src/ui/components/AuthDialog.tsx +++ b/packages/cli/src/ui/components/AuthDialog.tsx @@ -35,7 +35,7 @@ export function AuthDialog({ }, { label: 'Gemini API Key', value: AuthType.USE_GEMINI }, { - label: 'Login with Google Work', + label: 'Login with Google Workspace', value: AuthType.LOGIN_WITH_GOOGLE_ENTERPRISE, }, { label: 'Vertex AI', value: AuthType.USE_VERTEX_AI }, diff --git a/packages/cli/src/ui/hooks/useAuthCommand.ts b/packages/cli/src/ui/hooks/useAuthCommand.ts index 5cc67a07..fe890706 100644 --- a/packages/cli/src/ui/hooks/useAuthCommand.ts +++ b/packages/cli/src/ui/hooks/useAuthCommand.ts @@ -49,7 +49,7 @@ export const useAuthCommand = ( const errorMessage = settings.merged.selectedAuthType === AuthType.LOGIN_WITH_GOOGLE_PERSONAL - ? `Failed to login. Ensure your Google account is not an enterprise account. + ? `Failed to login. Ensure your Google account is not a Workspace account. Message: ${getErrorMessage(e)}` : `Failed to login. Message: ${getErrorMessage(e)}`; setAuthError(errorMessage); diff --git a/packages/cli/src/ui/hooks/useGeminiStream.ts b/packages/cli/src/ui/hooks/useGeminiStream.ts index e045fdeb..86540b68 100644 --- a/packages/cli/src/ui/hooks/useGeminiStream.ts +++ b/packages/cli/src/ui/hooks/useGeminiStream.ts @@ -22,7 +22,7 @@ import { GitService, EditorType, ThoughtSummary, - isAuthError, + UnauthorizedError, UserPromptEvent, } from '@gemini-cli/core'; import { type Part, type PartListUnion } from '@google/genai'; @@ -537,7 +537,7 @@ export const useGeminiStream = ( 'GEMINI_DEBUG: Caught error in useGeminiStream.ts:', JSON.stringify(error), ); - if (isAuthError(error)) { + if (error instanceof UnauthorizedError) { onAuthError(); } else if (!isNodeError(error) || error.name !== 'AbortError') { addItem( -- cgit v1.2.3