MCPcopy
hub / github.com/eolinker/goku_lite / WriteError

Function WriteError

console/controller/utils.go:88–109  ·  view source on GitHub ↗

WriteError 返回错误

(w http.ResponseWriter, statusCode, resultType, resultDesc string, resuleErr error)

Source from the content-addressed store, hash-verified

86
87//WriteError 返回错误
88func WriteError(w http.ResponseWriter, statusCode, resultType, resultDesc string, resuleErr error) {
89
90 ret := map[string]interface{}{
91 "type": resultType,
92 "statusCode": statusCode,
93 "resultDesc": resultDesc,
94 }
95
96 if resuleErr != nil {
97 log.Info(resuleErr)
98 }
99
100 data, err := json.Marshal(ret)
101 if err != nil {
102 w.WriteHeader(http.StatusInternalServerError)
103 log.WithFields(ret).Debug("write error:", err)
104 }
105
106 w.Write(data)
107 log.WithFields(ret).Debug("write error:", err)
108
109}

Callers 15

GetPluginListFunction · 0.92
AddPluginFunction · 0.92
EditPluginFunction · 0.92
DeletePluginFunction · 0.92
GetPluginInfoFunction · 0.92
GetPluginConfigFunction · 0.92
CheckIndexIsExistFunction · 0.92
CheckNameIsExistFunction · 0.92
StartPluginFunction · 0.92
StopPluginFunction · 0.92
BatchStopPluginFunction · 0.92

Calls 2

InfoMethod · 0.80
WriteMethod · 0.45

Tested by

no test coverage detected