hugolib: Make template panics into nice error messages

This commit is contained in:
Bjørn Erik Pedersen 2017-07-14 10:08:04 +02:00
parent 91f410ea90
commit 794ea21e94

View file

@ -1967,6 +1967,9 @@ func (s *Site) renderAndWritePage(name string, dest string, p *PageOutput, layou
}
func (s *Site) renderForLayouts(name string, d interface{}, w io.Writer, layouts ...string) error {
defer func() {
recover()
}()
templ := s.findFirstTemplate(layouts...)
if templ == nil {
return fmt.Errorf("[%s] Unable to locate layout for %q: %s\n", s.Language.Lang, name, layouts)