From: Bjørn Erik Pedersen Date: Mon, 19 Jun 2017 12:41:03 +0000 (+0200) Subject: hugolib: Fix error handling for JSON front matter X-Git-Tag: v0.24~10 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=fb53987a;p=brevno-suite%2Fhugo hugolib: Fix error handling for JSON front matter Fixes #3610 --- diff --git a/hugolib/page.go b/hugolib/page.go index d4aca37a..cf0a2144 100644 --- a/hugolib/page.go +++ b/hugolib/page.go @@ -1318,10 +1318,11 @@ func (p *Page) parse(reader io.Reader) error { p.lang = p.Source.File.Lang() meta, err := psr.Metadata() + if err != nil { + return fmt.Errorf("failed to parse page metadata for %q: %s", p.File.Path(), err) + } + if meta != nil { - if err != nil { - return fmt.Errorf("failed to parse page metadata for %s: %s", p.File.Path(), err) - } if err = p.update(meta); err != nil { return err }