bug in order
This commit is contained in:
@@ -342,18 +342,17 @@ func (h *Handler) DeleteAvatar(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
err := h.humanSvc.DeleteAvatar(r.Context(), humanId)
|
human, err := h.humanSvc.GetByID(r.Context(), humanId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
flog.Error("failed to delete avatar from human", "error", err)
|
flog.Error("failed to get human by id", "error", err, "humanId", humanId)
|
||||||
http.Error(w, "internal server error", http.StatusInternalServerError)
|
http.Error(w, "internal server error", http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// best-effort, gracefully continue
|
err := h.humanSvc.DeleteAvatar(r.Context(), humanId)
|
||||||
human, err := h.humanSvc.GetByID(r.Context(), humanId)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
flog.Error("failed to get human by id", "error", err, "humanId", humanId)
|
flog.Error("failed to delete avatar from human", "error", err)
|
||||||
w.WriteHeader(http.StatusNoContent)
|
http.Error(w, "internal server error", http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -401,6 +400,13 @@ func (h *Handler) UpdateAvatar(w http.ResponseWriter, r *http.Request) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
flog.Error("failed to update human avatar", "error", err, "humanId", humanId)
|
flog.Error("failed to update human avatar", "error", err, "humanId", humanId)
|
||||||
http.Error(w, "internal server error", http.StatusInternalServerError)
|
http.Error(w, "internal server error", http.StatusInternalServerError)
|
||||||
|
|
||||||
|
// best effort
|
||||||
|
err = h.depotSvc.Delete(r.Context(), object.ID)
|
||||||
|
if err != nil {
|
||||||
|
flog.Error("best-effort delete of object failed", "error", err)
|
||||||
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user