MCPcopy
hub / github.com/perkeep/perkeep / ServeError

Function ServeError

internal/httputil/httputil.go:63–70  ·  view source on GitHub ↗
(rw http.ResponseWriter, req *http.Request, err error)

Source from the content-addressed store, hash-verified

61}
62
63func ServeError(rw http.ResponseWriter, req *http.Request, err error) {
64 rw.WriteHeader(http.StatusInternalServerError)
65 if IsLocalhost(req) || env.IsDev() {
66 fmt.Fprintf(rw, "Server error: %s\n", err)
67 return
68 }
69 fmt.Fprintf(rw, "An internal error occurred, sorry.")
70}
71
72func ReturnJSON(rw http.ResponseWriter, data interface{}) {
73 ReturnJSONCode(rw, 200, data)

Callers 15

ServeCallbackMethod · 0.92
ServeCallbackMethod · 0.92
ServeSetupMethod · 0.92
ServeCallbackMethod · 0.92
ServeCallbackMethod · 0.92
ServeCallbackMethod · 0.92
ServeCallbackMethod · 0.92
ServeCallbackMethod · 0.92
ServeCallbackMethod · 0.92
ServeSetupMethod · 0.92
ServeCallbackMethod · 0.92

Calls 3

IsDevFunction · 0.92
IsLocalhostFunction · 0.70
WriteHeaderMethod · 0.45

Tested by

no test coverage detected