diff --git a/web/help.route.go b/web/help.route.go index 0fda164..4fd14aa 100644 --- a/web/help.route.go +++ b/web/help.route.go @@ -1,6 +1,7 @@ package web import ( + "fmt" "html/template" "net/http" @@ -22,11 +23,14 @@ func helpTemplate(w http.ResponseWriter, r *http.Request) { BarcodeOptions: barcodeOptions, } - tmpl := template.Must(template.New("base.html").ParseFiles("templates/base.html", "templates/help.html")) - - err := tmpl.Execute(w, data) + tmpl, err := template.ParseFiles("templates/base.html", "templates/help.html") if err != nil { - http.Error(w, err.Error(), http.StatusInternalServerError) - return + fmt.Println("Error parsing templates: ", err) + http.Error(w, "Unable to parse templates", 500) + } + err = tmpl.Execute(w, data) + if err != nil { + fmt.Println("Error rendering templates: ", err) + http.Error(w, "Unable to render templates", 500) } }