Skip to content

Commit

Permalink
log internal error (#104)
Browse files Browse the repository at this point in the history
* log internal error

* fix typo
  • Loading branch information
rockspore authored Oct 20, 2021
1 parent 65bc176 commit be663b8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,9 @@ func (m *manager) Authenticate(ctx context.Context, apiKey string,
authAttempted = true
}

var internalError error
if authenticationError != nil && authenticationError != ErrBadAuth {
internalError = authenticationError
authenticationError = ErrInternalError
}

Expand All @@ -158,6 +160,8 @@ func (m *manager) Authenticate(ctx context.Context, apiKey string,
redactedAC := util.SprintfRedacts(redacts, "%#v", authContext)
if authenticationError == nil {
log.Debugf("Authenticate success: %s", redactedAC)
} else if authenticationError == ErrInternalError {
log.Debugf("Authenticate error: %s [%v]", redactedAC, internalError)
} else {
log.Debugf("Authenticate error: %s [%v]", redactedAC, authenticationError)
}
Expand Down
1 change: 1 addition & 0 deletions auth/key/verify_api_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ func (kv *verifierImpl) singleFetchToken(ctx context.Context, apiKey string) (ma
}
res, err, _ := kv.herdBuster.Do(apiKey, fetch)
if err != nil {
log.Errorf("token fetching for API key failed: %v", err)
return nil, err
}

Expand Down

0 comments on commit be663b8

Please sign in to comment.