Source File
errorreporting.go
Belonging Package
golang.org/x/pkgsite/internal/middleware
package middleware
import (
)
func ( func(errorreporting.Entry)) Middleware {
return func( http.Handler) http.Handler {
return http.HandlerFunc(func( http.ResponseWriter, *http.Request) {
:= &erResponseWriter{ResponseWriter: }
if .bypass {
return
if .status < 500 {
return
if .status == http.StatusServiceUnavailable {
return
if .status == derrors.ToStatus(derrors.ProxyTimedOut) {
return
if .status == derrors.ToStatus(derrors.ProxyError) {
return
}
(errorreporting.Entry{
Error: fmt.Errorf("handler for %q returned status code %d", .URL.Path, .status),
Req: ,
})
})
}
}
type erResponseWriter struct {
http.ResponseWriter
bypass bool
status int
}
func ( *erResponseWriter) ( int) {
.status =
if .ResponseWriter.Header().Get(config.BypassErrorReportingHeader) == "true" {
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |