feat: log context cancelled error as warn instead of errors
All checks were successful
Cadoles/bouncer/pipeline/head This commit looks good

This commit is contained in:
wpetit 2024-10-02 12:13:50 +02:00
parent 382d17cc85
commit 69501f6302

View File

@ -232,7 +232,12 @@ func (s *Server) handleDefault(w http.ResponseWriter, r *http.Request) {
func (s *Server) handleError(w http.ResponseWriter, r *http.Request, status int, err error) {
err = errors.WithStack(err)
logger.Error(r.Context(), err.Error(), logger.CapturedE(err))
if errors.Is(err, context.Canceled) {
logger.Warn(r.Context(), err.Error(), logger.CapturedE(err))
} else {
logger.Error(r.Context(), err.Error(), logger.CapturedE(err))
}
s.renderErrorPage(w, r, err, status, http.StatusText(status))
}