MCPcopy Create free account
hub / github.com/0xUnixIO/pulse / writeUserGroupError

Function writeUserGroupError

internal/serverapi/usergroup.go:409–415  ·  view source on GitHub ↗

writeUserGroupError 根据错误类型返回对应 HTTP 状态码。

(w http.ResponseWriter, err error)

Source from the content-addressed store, hash-verified

407
408// writeUserGroupError 根据错误类型返回对应 HTTP 状态码。
409func writeUserGroupError(w http.ResponseWriter, err error) {
410 status := http.StatusInternalServerError
411 if errors.Is(err, usergroup.ErrUserGroupNotFound) {
412 status = http.StatusNotFound
413 }
414 writeJSON(w, status, map[string]any{"error": err.Error()})
415}

Callers 3

handleUserGroupByIDMethod · 0.85
handleGroupMembersMethod · 0.85
handleGroupSyncMethod · 0.85

Calls 2

writeJSONFunction · 0.70
ErrorMethod · 0.45

Tested by

no test coverage detected