Skip to content

Commit

Permalink
hugolib: Make template panics into nice error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
bep committed Jul 14, 2017
1 parent 91f410e commit 794ea21
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions hugolib/site.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 794ea21

Please sign in to comment.