MCPcopy Index your code
hub / github.com/go-dev-frame/sponge / isUserDefinedHTTPErrorCode

Method isUserDefinedHTTPErrorCode

pkg/errcode/response.go:176–187  ·  view source on GitHub ↗
(c *gin.Context, errCode int)

Source from the content-addressed store, hash-verified

174}
175
176func (resp *defaultResponse) isUserDefinedHTTPErrorCode(c *gin.Context, errCode int) bool {
177 if v, ok := resp.httpErrors[errCode]; ok {
178 httpCode := v.ToHTTPCode()
179 msg := http.StatusText(httpCode)
180 if msg == "" {
181 msg = "unknown error"
182 }
183 resp.response(c, httpCode, httpCode, msg, struct{}{})
184 return true
185 }
186 return false
187}
188
189// ToHTTPErr converted to http error
190func ToHTTPErr(st *status.Status) *Error { //nolint

Callers 1

handleHTTPErrorMethod · 0.95

Calls 2

responseMethod · 0.95
ToHTTPCodeMethod · 0.80

Tested by

no test coverage detected