fix(auth): return 503 when logout cache deletion fails

This commit is contained in:
kk10
2026-11-06 16:00:11 +03:00
parent bca081428a
commit 8a2d895274
3 changed files with 17 additions and 9 deletions
+6 -3
View File
@@ -64,11 +64,14 @@ func (h *AuthHandler) RevokeSession(w http.ResponseWriter, r *http.Request) {
}
err := h.service.Logout(r.Context(), token)
if errors.Is(err, service.ErrUnauthorized) {
switch {
case errors.Is(err, service.ErrSessionCacheUnavailable):
httpx.WriteError(w, http.StatusServiceUnavailable, dto.ErrorCodeUnavailable, "session cache unavailable", requestID)
return
case errors.Is(err, service.ErrUnauthorized):
httpx.WriteUnauthorized(w, httpx.BearerChallenge, requestID)
return
}
if err != nil {
case err != nil:
httpx.WriteInternalError(w, requestID, err)
return
}