MCPcopy
hub / github.com/cayleygraph/cayley / defaultErrorFunc

Function defaultErrorFunc

server/http/api_v2.go:410–416  ·  view source on GitHub ↗
(w query.ResponseWriter, err error)

Source from the content-addressed store, hash-verified

408}
409
410func defaultErrorFunc(w query.ResponseWriter, err error) {
411 data, _ := json.Marshal(err.Error())
412 w.WriteHeader(http.StatusBadRequest)
413 w.Write([]byte(`{"error": `))
414 w.Write(data)
415 w.Write([]byte("}\n"))
416}
417
418func writeResults(w io.Writer, r interface{}) {
419 enc := json.NewEncoder(w)

Callers

nothing calls this directly

Calls 4

WriteHeaderMethod · 0.65
WriteMethod · 0.65
MarshalMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected