File tree 2 files changed +11
-3
lines changed 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -96,10 +96,12 @@ func HTMLRenderer() *HTMLRender {
96
96
return htmlRender
97
97
}
98
98
99
- func ReloadHTMLTemplates () {
99
+ func ReloadHTMLTemplates () error {
100
100
if err := htmlRender .CompileTemplates (); err != nil {
101
101
log .Error ("Template error: %v\n %s" , err , log .Stack (2 ))
102
+ return err
102
103
}
104
+ return nil
103
105
}
104
106
105
107
func initHTMLRenderer () {
@@ -121,7 +123,7 @@ func initHTMLRenderer() {
121
123
122
124
if ! setting .IsProd {
123
125
go AssetFS ().WatchLocalChanges (graceful .GetManager ().ShutdownContext (), func () {
124
- ReloadHTMLTemplates ()
126
+ _ = ReloadHTMLTemplates ()
125
127
})
126
128
}
127
129
}
Original file line number Diff line number Diff line change @@ -21,7 +21,13 @@ import (
21
21
22
22
// ReloadTemplates reloads all the templates
23
23
func ReloadTemplates (ctx * context.PrivateContext ) {
24
- templates .ReloadHTMLTemplates ()
24
+ err := templates .ReloadHTMLTemplates ()
25
+ if err != nil {
26
+ ctx .JSON (http .StatusInternalServerError , private.Response {
27
+ UserMsg : fmt .Sprintf ("Template error: %v" , err ),
28
+ })
29
+ return
30
+ }
25
31
ctx .PlainText (http .StatusOK , "success" )
26
32
}
27
33
You can’t perform that action at this time.
0 commit comments