MCPcopy
hub / github.com/uber/aresdb / ServeHTTP

Method ServeHTTP

api/panic_handler.go:34–49  ·  view source on GitHub ↗

ServeHTTP serves http request for PanicHandler.

(rw http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

32
33// ServeHTTP serves http request for PanicHandler.
34func (handler PanicHandler) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
35 defer func() {
36 if r := recover(); r != nil {
37 rw.WriteHeader(http.StatusInternalServerError)
38 switch e := r.(type) {
39 case error:
40 rw.Write([]byte(e.Error()))
41 case string:
42 rw.Write([]byte(e))
43 default:
44 rw.Write([]byte("Unknown Panic"))
45 }
46 }
47 }()
48 handler.handler.ServeHTTP(rw, r)
49}

Callers 4

NoCacheFunction · 0.80
WithMetricsFuncFunction · 0.80
http_test.goFile · 0.80
mixedHandlerFunction · 0.80

Calls 3

WriteHeaderMethod · 0.80
WriteMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected