(w http.ResponseWriter, id int64, code int, msg string, err error)
| 172 | } |
| 173 | |
| 174 | func writeError(w http.ResponseWriter, id int64, code int, msg string, err error) { |
| 175 | m := msg |
| 176 | if err != nil { |
| 177 | m = fmt.Sprintf("%s: %v", msg, err) |
| 178 | } |
| 179 | |
| 180 | resp := cloud.MCPResponse{ |
| 181 | JSONRPC: "2.0", |
| 182 | ID: id, |
| 183 | Error: &cloud.MCPError{ |
| 184 | Code: code, |
| 185 | Message: m, |
| 186 | }, |
| 187 | } |
| 188 | writeJSON(w, http.StatusOK, resp) |
| 189 | } |
no test coverage detected