From e814b23b4866d03be8e4b869538dbc25a284b6c0 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Mon, 9 Mar 2026 01:23:43 -0700 Subject: [PATCH] fix: use appropriate error message in GetGroupDetails based on status Return "Group not found" only for 404, use "Failed to retrieve group" for other error statuses instead of always saying "Group not found". --- weed/admin/handlers/group_handlers.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/weed/admin/handlers/group_handlers.go b/weed/admin/handlers/group_handlers.go index 50e65ac73..2b2c3ef32 100644 --- a/weed/admin/handlers/group_handlers.go +++ b/weed/admin/handlers/group_handlers.go @@ -97,7 +97,12 @@ func (h *GroupHandlers) GetGroupDetails(w http.ResponseWriter, r *http.Request) group, err := h.adminServer.GetGroupDetails(r.Context(), name) if err != nil { glog.Errorf("Failed to get group details: %v", err) - writeJSONError(w, groupErrorToHTTPStatus(err), "Group not found") + status := groupErrorToHTTPStatus(err) + msg := "Failed to retrieve group" + if status == http.StatusNotFound { + msg = "Group not found" + } + writeJSONError(w, status, msg) return } writeJSON(w, http.StatusOK, group)