You've already forked oauth2-proxy
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:
@ -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
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user