spew error when date is invalid

This commit is contained in:
Aaron Bieber 2017-02-03 13:46:13 -07:00
parent b5fbc42521
commit 7cf885be4a

View File

@ -155,7 +155,11 @@ func (p *Post) LoadFromFile(f string) error {
} }
if DateRE.Match(line) { if DateRE.Match(line) {
d := DateRE.ReplaceAllString(string(line), "$1") d := DateRE.ReplaceAllString(string(line), "$1")
p.Date, _ = time.Parse(time.RFC1123, d) p.Date, err = time.Parse(time.RFC1123, d)
if err != nil {
log.Printf("error in '%s'\n", f)
log.Fatal(err)
}
fmt.Printf("Date: %s\n", p.Date) fmt.Printf("Date: %s\n", p.Date)
useLine = false useLine = false
} }