From a472429820f52d5d9b474ba790dc53e45010ff0d Mon Sep 17 00:00:00 2001 From: Seth Hoenig Date: Thu, 25 Jun 2026 07:46:33 -0500 Subject: [PATCH] htmx: include error message when template execution fails --- htmx/template.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htmx/template.go b/htmx/template.go index 879379f..41e1f00 100644 --- a/htmx/template.go +++ b/htmx/template.go @@ -34,7 +34,7 @@ func (t *Template) Write(w io.Writer) error { root := template.New("htmx-root").Funcs(t.Funcs) tree, terr := root.ParseFS(t.FS, filepath.Base(t.Filename)) if terr != nil { - return terr + return fmt.Errorf("unable to parse filesystem: %w", terr) } x := tree.Lookup(strings.TrimSuffix(filepath.Base(t.Filename), ".html")) @@ -44,7 +44,7 @@ func (t *Template) Write(w io.Writer) error { xerr := x.Execute(w, t.Fields) if xerr != nil { - return fmt.Errorf("unable to execute %q", t.Filename) + return fmt.Errorf("unable to execute %q: %w", t.Filename, xerr) } return nil