Logger: Add feature toggle for errors in HTTP request logs (#64425)
This commit is contained in:
@@ -16,6 +16,7 @@ package web
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"html/template"
|
||||
"net"
|
||||
@@ -23,6 +24,7 @@ import (
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
"syscall"
|
||||
|
||||
"github.com/grafana/grafana/pkg/util/errutil"
|
||||
"github.com/grafana/grafana/pkg/util/errutil/errhttp"
|
||||
@@ -104,6 +106,9 @@ func (ctx *Context) HTML(status int, name string, data interface{}) {
|
||||
ctx.Resp.Header().Set(headerContentType, contentTypeHTML)
|
||||
ctx.Resp.WriteHeader(status)
|
||||
if err := ctx.template.ExecuteTemplate(ctx.Resp, name, data); err != nil {
|
||||
if errors.Is(err, syscall.EPIPE) { // Client has stopped listening.
|
||||
return
|
||||
}
|
||||
panic(fmt.Sprintf("Context.HTML - Error rendering template: %s. You may need to build frontend assets \n %s", name, err.Error()))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user