Skip to content

Commit e53fcbb

Browse files
authored
log context cancellation as debug instead of error (#3268)
1 parent 1e71536 commit e53fcbb

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

network/error_handler.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ limitations under the License.
1717
package network
1818

1919
import (
20+
"context"
21+
"errors"
2022
"net/http"
2123
"os"
2224

@@ -29,6 +31,10 @@ import (
2931
// Deprecated: Use handler.Error instead.
3032
func ErrorHandler(logger *zap.SugaredLogger) func(http.ResponseWriter, *http.Request, error) {
3133
return func(w http.ResponseWriter, req *http.Request, err error) {
34+
if errors.Is(err, context.Canceled) {
35+
logger.Debugw("request context canceled", zap.Error(err))
36+
return
37+
}
3238
ss := readSockStat(logger)
3339
logger.Errorw("error reverse proxying request; sockstat: "+ss, zap.Error(err))
3440
http.Error(w, err.Error(), http.StatusBadGateway)

0 commit comments

Comments
 (0)