mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Context: add better error message when it panics loading a template (#65219)
add better error message about building frontend assets when the web server panics loading a template
This commit is contained in:
parent
b033fe8d73
commit
d561920147
@ -16,6 +16,7 @@ package web
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"html/template"
|
||||
"net"
|
||||
"net/http"
|
||||
@ -103,7 +104,7 @@ 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 {
|
||||
panic("Context.HTML:" + err.Error())
|
||||
panic(fmt.Sprintf("Context.HTML - Error rendering template: %s. You may need to build frontend assets \n %s", name, err.Error()))
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user