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

Function executeRequestSafelyMiddleware

v2/internal/api.go:132–144  ·  view source on GitHub ↗
(next http.Handler)

Source from the content-addressed store, hash-verified

130}
131
132func executeRequestSafelyMiddleware(next http.Handler) http.Handler {
133 return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
134 defer func() {
135 if x := recover(); x != nil {
136 c := w.(*aeContext)
137 logf(c, 4, "%s", renderPanic(x)) // 4 == critical
138 c.outCode = 500
139 }
140 }()
141
142 next.ServeHTTP(w, r)
143 })
144}
145
146func renderPanic(x interface{}) string {
147 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…