mirror of
https://github.com/netbirdio/netbird.git
synced 2025-06-20 17:58:02 +02:00
Add extra logs for account not found, peer login and getAccount (#2053)
This commit is contained in:
parent
d4c47eaf8a
commit
f176807ebe
@ -1768,6 +1768,8 @@ func (am *DefaultAccountManager) GetAccountFromToken(claims jwtclaims.Authorizat
|
|||||||
//
|
//
|
||||||
// Existing user + Existing account + Existing domain reclassified Domain as private -> Nothing changes (index domain)
|
// Existing user + Existing account + Existing domain reclassified Domain as private -> Nothing changes (index domain)
|
||||||
func (am *DefaultAccountManager) getAccountWithAuthorizationClaims(claims jwtclaims.AuthorizationClaims) (*Account, error) {
|
func (am *DefaultAccountManager) getAccountWithAuthorizationClaims(claims jwtclaims.AuthorizationClaims) (*Account, error) {
|
||||||
|
log.Tracef("getting account with authorization claims. User ID: \"%s\", Account ID: \"%s\", Domain: \"%s\", Domain Category: \"%s\"",
|
||||||
|
claims.UserId, claims.AccountId, claims.Domain, claims.DomainCategory)
|
||||||
if claims.UserId == "" {
|
if claims.UserId == "" {
|
||||||
return nil, fmt.Errorf("user ID is empty")
|
return nil, fmt.Errorf("user ID is empty")
|
||||||
}
|
}
|
||||||
|
@ -368,7 +368,7 @@ func (s *GRPCServer) Login(ctx context.Context, req *proto.EncryptedMessage) (*p
|
|||||||
})
|
})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warnf("failed logging in peer %s", peerKey)
|
log.Warnf("failed logging in peer %s: %s", peerKey, err)
|
||||||
return nil, mapError(err)
|
return nil, mapError(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -390,7 +390,7 @@ func (s *SqlStore) GetAccount(accountID string) (*Account, error) {
|
|||||||
Preload(clause.Associations).
|
Preload(clause.Associations).
|
||||||
First(&account, "id = ?", accountID)
|
First(&account, "id = ?", accountID)
|
||||||
if result.Error != nil {
|
if result.Error != nil {
|
||||||
log.Errorf("error when getting account from the store: %s", result.Error)
|
log.Errorf("error when getting account %s from the store: %s", accountID, result.Error)
|
||||||
if errors.Is(result.Error, gorm.ErrRecordNotFound) {
|
if errors.Is(result.Error, gorm.ErrRecordNotFound) {
|
||||||
return nil, status.Errorf(status.NotFound, "account not found")
|
return nil, status.Errorf(status.NotFound, "account not found")
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user