MCPcopy Create free account
hub / github.com/golang/appengine / executeRequestSafelyMiddleware

Function executeRequestSafelyMiddleware

internal/api.go:170–182  ·  view source on GitHub ↗
(next http.Handler)

Source from the content-addressed store, hash-verified

168}
169
170func executeRequestSafelyMiddleware(next http.Handler) http.Handler {
171 return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
172 defer func() {
173 if x := recover(); x != nil {
174 c := w.(*aeContext)
175 logf(c, 4, "%s", renderPanic(x)) // 4 == critical
176 c.outCode = 500
177 }
178 }()
179
180 next.ServeHTTP(w, r)
181 })
182}
183
184func renderPanic(x interface{}) string {
185 buf := make([]byte, 16<<10) // 16 KB should be plenty

Callers 1

MiddlewareFunction · 0.70

Calls 3

logfFunction · 0.70
renderPanicFunction · 0.70
ServeHTTPMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…