Skip to content

Commit e9c60a0

Browse files
authored
Merge pull request router-for-me#1910 from thebtf/fix/gemini-oauth-error-messages
fix: surface upstream error details in Gemini CLI OAuth onboarding UI
2 parents 98a1bb5 + 11a795a commit e9c60a0

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

internal/api/handlers/management/auth_files.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1306,12 +1306,12 @@ func (h *Handler) RequestGeminiCLIToken(c *gin.Context) {
13061306
projects, errAll := onboardAllGeminiProjects(ctx, gemClient, &ts)
13071307
if errAll != nil {
13081308
log.Errorf("Failed to complete Gemini CLI onboarding: %v", errAll)
1309-
SetOAuthSessionError(state, "Failed to complete Gemini CLI onboarding")
1309+
SetOAuthSessionError(state, fmt.Sprintf("Failed to complete Gemini CLI onboarding: %v", errAll))
13101310
return
13111311
}
13121312
if errVerify := ensureGeminiProjectsEnabled(ctx, gemClient, projects); errVerify != nil {
13131313
log.Errorf("Failed to verify Cloud AI API status: %v", errVerify)
1314-
SetOAuthSessionError(state, "Failed to verify Cloud AI API status")
1314+
SetOAuthSessionError(state, fmt.Sprintf("Failed to verify Cloud AI API status: %v", errVerify))
13151315
return
13161316
}
13171317
ts.ProjectID = strings.Join(projects, ",")
@@ -1320,7 +1320,7 @@ func (h *Handler) RequestGeminiCLIToken(c *gin.Context) {
13201320
ts.Auto = false
13211321
if errSetup := performGeminiCLISetup(ctx, gemClient, &ts, ""); errSetup != nil {
13221322
log.Errorf("Google One auto-discovery failed: %v", errSetup)
1323-
SetOAuthSessionError(state, "Google One auto-discovery failed")
1323+
SetOAuthSessionError(state, fmt.Sprintf("Google One auto-discovery failed: %v", errSetup))
13241324
return
13251325
}
13261326
if strings.TrimSpace(ts.ProjectID) == "" {
@@ -1331,19 +1331,19 @@ func (h *Handler) RequestGeminiCLIToken(c *gin.Context) {
13311331
isChecked, errCheck := checkCloudAPIIsEnabled(ctx, gemClient, ts.ProjectID)
13321332
if errCheck != nil {
13331333
log.Errorf("Failed to verify Cloud AI API status: %v", errCheck)
1334-
SetOAuthSessionError(state, "Failed to verify Cloud AI API status")
1334+
SetOAuthSessionError(state, fmt.Sprintf("Failed to verify Cloud AI API status: %v", errCheck))
13351335
return
13361336
}
13371337
ts.Checked = isChecked
13381338
if !isChecked {
13391339
log.Error("Cloud AI API is not enabled for the auto-discovered project")
1340-
SetOAuthSessionError(state, "Cloud AI API not enabled")
1340+
SetOAuthSessionError(state, fmt.Sprintf("Cloud AI API not enabled for project %s", ts.ProjectID))
13411341
return
13421342
}
13431343
} else {
13441344
if errEnsure := ensureGeminiProjectAndOnboard(ctx, gemClient, &ts, requestedProjectID); errEnsure != nil {
13451345
log.Errorf("Failed to complete Gemini CLI onboarding: %v", errEnsure)
1346-
SetOAuthSessionError(state, "Failed to complete Gemini CLI onboarding")
1346+
SetOAuthSessionError(state, fmt.Sprintf("Failed to complete Gemini CLI onboarding: %v", errEnsure))
13471347
return
13481348
}
13491349

@@ -1356,13 +1356,13 @@ func (h *Handler) RequestGeminiCLIToken(c *gin.Context) {
13561356
isChecked, errCheck := checkCloudAPIIsEnabled(ctx, gemClient, ts.ProjectID)
13571357
if errCheck != nil {
13581358
log.Errorf("Failed to verify Cloud AI API status: %v", errCheck)
1359-
SetOAuthSessionError(state, "Failed to verify Cloud AI API status")
1359+
SetOAuthSessionError(state, fmt.Sprintf("Failed to verify Cloud AI API status: %v", errCheck))
13601360
return
13611361
}
13621362
ts.Checked = isChecked
13631363
if !isChecked {
13641364
log.Error("Cloud AI API is not enabled for the selected project")
1365-
SetOAuthSessionError(state, "Cloud AI API not enabled")
1365+
SetOAuthSessionError(state, fmt.Sprintf("Cloud AI API not enabled for project %s", ts.ProjectID))
13661366
return
13671367
}
13681368
}

0 commit comments

Comments
 (0)