feat(auth): Improve auth dialog error handling and messaging (#11320)

This commit is contained in:
Abhi
2025-10-16 18:08:42 -04:00
committed by GitHub
parent 01c577c371
commit 02241e9126
6 changed files with 18 additions and 7 deletions
+3 -1
View File
@@ -45,7 +45,9 @@ describe('validateAuthMethod', () => {
it('should return an error message if GEMINI_API_KEY is not set', () => {
vi.stubEnv('GEMINI_API_KEY', undefined);
expect(validateAuthMethod(AuthType.USE_GEMINI)).toBe(
'GEMINI_API_KEY environment variable not found. Add that to your environment and try again (no reload needed if using .env)!',
'GEMINI_API_KEY not found. Find your existing key or generate a new one at: https://aistudio.google.com/apikey\n' +
'\n' +
'To continue, please set the GEMINI_API_KEY environment variable or add it to a .env file.',
);
});
});
+5 -1
View File
@@ -18,7 +18,11 @@ export function validateAuthMethod(authMethod: string): string | null {
if (authMethod === AuthType.USE_GEMINI) {
if (!process.env['GEMINI_API_KEY']) {
return 'GEMINI_API_KEY environment variable not found. Add that to your environment and try again (no reload needed if using .env)!';
return (
'GEMINI_API_KEY not found. Find your existing key or generate a new one at: https://aistudio.google.com/apikey\n' +
'\n' +
'To continue, please set the GEMINI_API_KEY environment variable or add it to a .env file.'
);
}
return null;
}