Skip to content

Commit

Permalink
Merge pull request #70 from UKHomeOffice/fix_error_on_panic
Browse files Browse the repository at this point in the history
Error on Panic
  • Loading branch information
lewismarshall authored Apr 17, 2018
2 parents d7983be + 1ba6378 commit aa26e42
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ func run(c *cli.Context) error {
}

func render(tmpl string, vars map[string]string) (string, error) {
var err error
fm := template.FuncMap{
"contains": strings.Contains,
"hasPrefix": strings.HasPrefix,
Expand All @@ -204,8 +203,8 @@ func render(tmpl string, vars map[string]string) (string, error) {
"file": fileRender,
}
defer func() {
if r := recover(); r != nil {
err = fmt.Errorf("failed to parse template, error: %s", r)
if err := recover(); err != nil {
logError.Fatal(err)
}
}()
t := template.Must(template.New("template").Funcs(fm).Parse(tmpl))
Expand Down

0 comments on commit aa26e42

Please sign in to comment.