Skip to content

Commit 794ea21

Browse files
committed
hugolib: Make template panics into nice error messages
1 parent 91f410e commit 794ea21

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

‎hugolib/site.go‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1967,6 +1967,9 @@ func (s *Site) renderAndWritePage(name string, dest string, p *PageOutput, layou
19671967
}
19681968

19691969
func (s *Site) renderForLayouts(name string, d interface{}, w io.Writer, layouts ...string) error {
1970+
defer func() {
1971+
recover()
1972+
}()
19701973
templ := s.findFirstTemplate(layouts...)
19711974
if templ == nil {
19721975
return fmt.Errorf("[%s] Unable to locate layout for %q: %s\n", s.Language.Lang, name, layouts)

0 commit comments

Comments
 (0)