hugolib: Improve error and reload handling of hook templates in server mode

Fixes #6635
This commit is contained in:
Bjørn Erik Pedersen
2019-12-20 08:11:36 +01:00
parent 0453683816
commit 8a58ebb311
8 changed files with 121 additions and 20 deletions

View File

@@ -629,9 +629,12 @@ func (p *pageState) Render(layout ...string) (template.HTML, error) {
}
// wrapError adds some more context to the given error if possible
// wrapError adds some more context to the given error if possible/needed
func (p *pageState) wrapError(err error) error {
if _, ok := err.(*herrors.ErrorWithFileContext); ok {
// Preserve the first file context.
return err
}
var filename string
if !p.File().IsZero() {
filename = p.File().Filename()