fix(api): the quota/link admin sub-resources require a live user (404, not FK 500)

This commit is contained in:
Lemon-miaow committed 2026-09-23 04:56:06 +08:00
1 parent fbb6b0c180
commit 1918da29be
5 files changed
+146 -1

No files matched your search

+8
View File
@@ -281,6 +281,10 @@ func (a *API) handleGetQuotas(w http.ResponseWriter, r *http.Request) {
}
v, err := a.Repo.GetQuotas(r.Context(), id)
if err != nil {
if errors.Is(err, ErrNotFound) {
writeError(w, r, newError(http.StatusNotFound, "not_found", "user not found"))
return
}
writeError(w, r, err)
return
}
@@ -477,6 +481,10 @@ func (a *API) handleLinkAccount(w http.ResponseWriter, r *http.Request) {
"this UUID is already linked to a different user"))
return
}
if errors.Is(err, ErrNotFound) {
writeError(w, r, newError(http.StatusNotFound, "not_found", "user not found"))
return
}
writeError(w, r, err)
return
}