Skip to content

Commit 1540314

Browse files
committed
fix: handle error returns in auth commands
1 parent 7162076 commit 1540314

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

cmd/auth.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,9 @@ This is useful when working with multiple organizations or environments.`,
221221
if len(accounts) == 1 {
222222
// Only one account, just confirm it's active
223223
for accountName := range accounts {
224-
cfg.SetActiveAccount(accountName)
224+
if err := cfg.SetActiveAccount(accountName); err != nil {
225+
return fmt.Errorf("failed to set active account: %w", err)
226+
}
225227
if err := config.SaveConfig(cfg); err != nil {
226228
return fmt.Errorf("failed to save config: %w", err)
227229
}
@@ -249,7 +251,9 @@ This is useful when working with multiple organizations or environments.`,
249251
fmt.Println()
250252
}
251253
fmt.Print("\nEnter account name to switch to: ")
252-
fmt.Scanln(&targetAccount)
254+
if _, err := fmt.Scanln(&targetAccount); err != nil {
255+
return fmt.Errorf("failed to read input: %w", err)
256+
}
253257
}
254258

255259
if targetAccount == "" {

0 commit comments

Comments
 (0)