Improve error handling for outputEntries

This commit is contained in:
Peter Stuifzand 2019-12-22 11:34:08 +01:00
parent e6c4095e78
commit 4f8b167e7d

16
main.go
View File

@ -29,19 +29,23 @@ func main() {
items = filterEntriesAfter(items, now.With(time.Now()).Monday())
outputEntries(items)
}
func outputEntries(items []microsub.Item) {
t, err := template.ParseFiles("templates/weekly.html")
err = outputEntries(items)
if err != nil {
log.Fatal(err)
}
}
func outputEntries(items []microsub.Item) error {
t, err := template.ParseFiles("templates/weekly.html")
if err != nil {
return err
}
err = t.Execute(os.Stdout, items)
if err != nil {
log.Fatal(err)
return err
}
return nil
}
func getEntriesForFeed(u *url.URL) ([]microsub.Item, error) {