1
0
mirror of https://github.com/oauth2-proxy/oauth2-proxy.git synced 2025-08-08 22:46:33 +02:00

feat: differentiate between "no available key" and error for redis sessions (#3093)

* add some better error handling

* add changelog entry

Signed-off-by: Jan Larwig <jan@larwig.com>

---------

Signed-off-by: Jan Larwig <jan@larwig.com>
Co-authored-by: Jan Larwig <jan@larwig.com>
This commit is contained in:
nobletrout
2025-07-24 02:33:06 -04:00
committed by GitHub
parent e75a258299
commit f4b33b64bd
2 changed files with 6 additions and 1 deletions

View File

@ -49,9 +49,12 @@ func (store *SessionStore) Save(ctx context.Context, key string, value []byte, e
// cookie within the HTTP request object
func (store *SessionStore) Load(ctx context.Context, key string) ([]byte, error) {
value, err := store.Client.Get(ctx, key)
if err != nil {
if err == redis.Nil {
return nil, fmt.Errorf("session does not exist")
} else if err != nil {
return nil, fmt.Errorf("error loading redis session: %v", err)
}
return value, nil
}