diff options
author | Runxi Yu <me@runxiyu.org> | 2025-03-22 13:59:00 +0800 |
---|---|---|
committer | Runxi Yu <me@runxiyu.org> | 2025-03-22 13:59:00 +0800 |
commit | 1f185f329bb82c87b250fb2312ae873d69a20d38 (patch) | |
tree | 892ad487e7e1154fcb71fbe05acf9e583592e96b /http_template.go | |
parent | Variable name lengths (diff) | |
download | forge-1f185f329bb82c87b250fb2312ae873d69a20d38.tar.gz forge-1f185f329bb82c87b250fb2312ae873d69a20d38.tar.zst forge-1f185f329bb82c87b250fb2312ae873d69a20d38.zip |
Use a custom errPage500
Diffstat (limited to 'http_template.go')
-rw-r--r-- | http_template.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/http_template.go b/http_template.go index e8520a9..82a1497 100644 --- a/http_template.go +++ b/http_template.go @@ -3,12 +3,17 @@ package main -import "net/http" +import ( + "net/http" + + "go.lindenii.runxiyu.org/lindenii-common/clog" +) // renderTemplate abstracts out the annoyances of reporting template rendering // errors. func renderTemplate(w http.ResponseWriter, templateName string, params map[string]any) { if err := templates.ExecuteTemplate(w, templateName, params); err != nil { - http.Error(w, "Error rendering template: "+err.Error(), http.StatusInternalServerError) + http.Error(w, "error rendering template: "+err.Error(), http.StatusInternalServerError) + clog.Error(err.Error()) } } |