upgrade recoverer to suppress the noise on net/http: abort Handler

This commit is contained in:
Umputun 2021-04-12 12:08:50 -05:00
parent bdae15b274
commit 3ced8397c5
4 changed files with 7 additions and 3 deletions

2
go.mod
View File

@ -5,7 +5,7 @@ go 1.16
require ( require (
github.com/fsouza/go-dockerclient v1.7.2 github.com/fsouza/go-dockerclient v1.7.2
github.com/go-pkgz/lgr v0.10.4 github.com/go-pkgz/lgr v0.10.4
github.com/go-pkgz/rest v1.9.0 github.com/go-pkgz/rest v1.9.1
github.com/gorilla/handlers v1.5.1 github.com/gorilla/handlers v1.5.1
github.com/pkg/errors v0.9.1 github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.7.0 github.com/stretchr/testify v1.7.0

2
go.sum
View File

@ -49,6 +49,8 @@ github.com/go-pkgz/rest v1.8.1 h1:M0sMbgcWxHpKjXw7Z8uF6uNcsLynaPoR0CHGczjYSw0=
github.com/go-pkgz/rest v1.8.1/go.mod h1:wZ/dGipZUaF9to0vIQl7PwDHgWQDB0jsrFg1xnAKLDw= github.com/go-pkgz/rest v1.8.1/go.mod h1:wZ/dGipZUaF9to0vIQl7PwDHgWQDB0jsrFg1xnAKLDw=
github.com/go-pkgz/rest v1.9.0 h1:cbBXd4YH0X6W64zneDGF+Ym3Mgj7Gv54krIEJjbQACs= github.com/go-pkgz/rest v1.9.0 h1:cbBXd4YH0X6W64zneDGF+Ym3Mgj7Gv54krIEJjbQACs=
github.com/go-pkgz/rest v1.9.0/go.mod h1:wZ/dGipZUaF9to0vIQl7PwDHgWQDB0jsrFg1xnAKLDw= github.com/go-pkgz/rest v1.9.0/go.mod h1:wZ/dGipZUaF9to0vIQl7PwDHgWQDB0jsrFg1xnAKLDw=
github.com/go-pkgz/rest v1.9.1 h1:JW876BgJJ/MOkAYRnnzpfX7xUqIav+ou1LSVTtQq/Lo=
github.com/go-pkgz/rest v1.9.1/go.mod h1:wZ/dGipZUaF9to0vIQl7PwDHgWQDB0jsrFg1xnAKLDw=
github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=

View File

@ -60,7 +60,9 @@ func Recoverer(l logger.Backend) func(http.Handler) http.Handler {
defer func() { defer func() {
if rvr := recover(); rvr != nil { if rvr := recover(); rvr != nil {
l.Logf("request panic for %s from %s, %v", r.URL.String(), r.RemoteAddr, rvr) l.Logf("request panic for %s from %s, %v", r.URL.String(), r.RemoteAddr, rvr)
l.Logf(string(debug.Stack())) if rvr != http.ErrAbortHandler {
l.Logf(string(debug.Stack()))
}
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError) http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
} }
}() }()

2
vendor/modules.txt vendored
View File

@ -70,7 +70,7 @@ github.com/fsouza/go-dockerclient
# github.com/go-pkgz/lgr v0.10.4 # github.com/go-pkgz/lgr v0.10.4
## explicit ## explicit
github.com/go-pkgz/lgr github.com/go-pkgz/lgr
# github.com/go-pkgz/rest v1.9.0 # github.com/go-pkgz/rest v1.9.1
## explicit ## explicit
github.com/go-pkgz/rest github.com/go-pkgz/rest
github.com/go-pkgz/rest/logger github.com/go-pkgz/rest/logger