Skip to content

Commit fa8134a

Browse files
committed
fix error handling
1 parent 2853125 commit fa8134a

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

internal/cmd/curl/curl.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@ func getBearerToken(p *print.Printer) (string, error) {
183183

184184
accessToken, err := auth.GetValidAccessToken(p)
185185
if err != nil {
186-
return "", err
186+
p.Debug(print.ErrorLevel, "get valid access token: %v", err)
187+
return "", &errors.SessionExpiredError{}
187188
}
188189

189190
return accessToken, nil

internal/pkg/auth/auth.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ func GetValidAccessToken(p *print.Printer) (string, error) {
202202
// Refresh the tokens
203203
err = refreshTokens(utf)
204204
if err != nil {
205-
return "", fmt.Errorf("access token expired and refresh token is invalid. Please run 'stackit auth login' to re-authenticate: %w", err)
205+
return "", fmt.Errorf("access token and refresh token expired: %w", err)
206206
}
207207

208208
// Return the new access token

0 commit comments

Comments
 (0)