Improve Auth error messaging (#1358)

This commit is contained in:
Tommaso Sciortino
2025-06-23 18:37:41 -07:00
committed by GitHub
parent 104f23da90
commit 0abd2a644e
9 changed files with 57 additions and 31 deletions

View File

@@ -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 },

View File

@@ -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);

View File

@@ -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(