MCPcopy Create free account
hub / github.com/astercloud/aster / ErrorWithDetails

Function ErrorWithDetails

pkg/server/response.go:55–66  ·  view source on GitHub ↗

ErrorWithDetails 辅助函数:发送带详细信息的错误响应

(w http.ResponseWriter, status int, code, message, details string)

Source from the content-addressed store, hash-verified

53
54// ErrorWithDetails 辅助函数:发送带详细信息的错误响应
55func ErrorWithDetails(w http.ResponseWriter, status int, code, message, details string) {
56 w.Header().Set("Content-Type", "application/json; charset=utf-8")
57 w.WriteHeader(status)
58 _ = json.NewEncoder(w).Encode(&APIResponse{
59 Success: false,
60 Error: &APIError{
61 Code: code,
62 Message: message,
63 Details: details,
64 },
65 })
66}
67
68// Paginated 辅助函数:发送分页响应
69func Paginated(w http.ResponseWriter, items any, total, page, pageSize int) {

Callers

nothing calls this directly

Calls 1

SetMethod · 0.65

Tested by

no test coverage detected