Fix: Better error handling
Session insertion middleware now has better error handling for fetching an account based on a session. Not found is treated as not an error since it is likely to happen that a session is used post account deletion
This commit is contained in:
parent
ad68e97eaf
commit
9169cec4bb
1 changed files with 7 additions and 1 deletions
|
@ -132,7 +132,13 @@ func checkSessionMiddleware(handler http.Handler) http.Handler {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
acc, err := store.FindAccountByPasskeyId(session.UserID)
|
acc, err := store.FindAccountByPasskeyId(session.UserID)
|
||||||
if err != nil {
|
switch err {
|
||||||
|
case storage.ErrEntryNotFound:
|
||||||
|
log.Info().Msg("No account for the given passkey id found. It probably got deleted")
|
||||||
|
handler.ServeHTTP(w, r)
|
||||||
|
return
|
||||||
|
case nil:
|
||||||
|
default:
|
||||||
// Failed to get account for passkey id. Log, then move on as if no session is set
|
// Failed to get account for passkey id. Log, then move on as if no session is set
|
||||||
log.Error().
|
log.Error().
|
||||||
Err(err).
|
Err(err).
|
||||||
|
|
Loading…
Reference in a new issue