Skip to content

Commit

Permalink
use fmt.Errorf instead of errors.New(fmt.Sprintf(...
Browse files Browse the repository at this point in the history
  • Loading branch information
dannyvankooten committed Nov 24, 2023
1 parent a4464b8 commit 9c2f444
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions gozer.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"bytes"
_ "embed"
"encoding/xml"
"errors"
"flag"
"fmt"
"github.com/BurntSushi/toml"
Expand Down Expand Up @@ -96,7 +95,7 @@ func parseFrontMatter(p *Page) error {
// find pos of closing front matter
pos := bytes.Index(buf, frontMatter)
if pos == -1 {
return errors.New("missing closing front-matter identifier")
return fmt.Errorf("missing closing front-matter identifier in %s", p.Filepath)
}

return toml.Unmarshal(buf[:pos], p)
Expand Down Expand Up @@ -148,7 +147,7 @@ func (s *Site) buildPage(p *Page) error {

tmpl := templates.Lookup(p.Template)
if tmpl == nil {
return errors.New(fmt.Sprintf("Invalid template name: %s", p.Template))
return fmt.Errorf("invalid template name: %s", p.Template)
}

return tmpl.Execute(fh, map[string]any{
Expand Down

0 comments on commit 9c2f444

Please sign in to comment.