mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-29 18:32:11 -05:00
hugolib: Make template panics into nice error messages
This commit is contained in:
parent
91f410ea90
commit
794ea21e94
1 changed files with 3 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue