MCPcopy
hub / github.com/kubeedge/kubeedge / ErrorMessage

Function ErrorMessage

cloud/pkg/cloudhub/servers/httpserver/resps/response.go:13–21  ·  view source on GitHub ↗
(w http.ResponseWriter, code int, msg string)

Source from the content-addressed store, hash-verified

11}
12
13func ErrorMessage(w http.ResponseWriter, code int, msg string) {
14 if code == 0 {
15 code = http.StatusInternalServerError
16 }
17 w.WriteHeader(code)
18 if _, err := w.Write([]byte(msg)); err != nil {
19 klog.Errorf("failed to write a error message to the response, err: %v", err)
20 }
21}
22
23func OK(w http.ResponseWriter, body []byte) {
24 w.WriteHeader(http.StatusOK)

Callers 3

EdgeCoreClientCertFunction · 0.92
TestErrorMessageFunction · 0.85
ErrorFunction · 0.85

Calls 2

WriteMethod · 0.65
WriteHeaderMethod · 0.45

Tested by 1

TestErrorMessageFunction · 0.68