Skip to content

Commit e93fb77

Browse files
fix: check for redis nil as well os sql.ErrNoRows
Signed-off-by: Henry Whitaker <henrywhitaker3@outlook.com>
1 parent 5af9227 commit e93fb77

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

internal/service/auth_service.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"sync"
1111
"time"
1212

13+
"github.com/redis/rueidis"
1314
"github.com/steveiliop56/tinyauth/internal/config"
1415
"github.com/steveiliop56/tinyauth/internal/repository"
1516
"github.com/steveiliop56/tinyauth/internal/utils"
@@ -362,7 +363,7 @@ func (auth *AuthService) GetSessionCookie(c *gin.Context) (repository.Session, e
362363
session, err := auth.queries.GetSession(c, cookie)
363364

364365
if err != nil {
365-
if errors.Is(err, sql.ErrNoRows) {
366+
if errors.Is(err, sql.ErrNoRows) || rueidis.IsRedisNil(err) {
366367
return repository.Session{}, fmt.Errorf("session not found")
367368
}
368369
return repository.Session{}, err

0 commit comments

Comments
 (0)