aboutsummaryrefslogtreecommitdiffstats
path: root/todolist/parser.go
diff options
context:
space:
mode:
authorQuey-Liang Kao <s101062801@m101.nthu.edu.tw>2017-01-20 12:40:12 -0600
committerGitHub <noreply@github.com>2017-01-20 12:40:12 -0600
commit9edce9ad2c7cca5dc60cff8ce45a9855ab719365 (patch)
tree563c75d07877de03334d612a661413b9fd703725 /todolist/parser.go
parentde346783c83061b2b88e5b158f6a659d569f206e (diff)
parente81c005dd64e7f206bfe5d2dd2bccc295b45fb9e (diff)
Merge pull request #22 from NonerKao/issue/output-no-panic
Makes all output messages consistent
Diffstat (limited to 'todolist/parser.go')
-rw-r--r--todolist/parser.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/todolist/parser.go b/todolist/parser.go
index 767785b..62d864d 100644
--- a/todolist/parser.go
+++ b/todolist/parser.go
@@ -2,6 +2,7 @@ package todolist
import (
"fmt"
+ "os"
"regexp"
"strconv"
"strings"
@@ -116,7 +117,11 @@ func (p *Parser) parseArbitraryDateWithYear(_date string, year int) time.Time {
if date, err := time.Parse("2 Jan 2006", res); err == nil {
return date
}
- panic(fmt.Errorf("Could not parse the date you gave me: '%s'", _date))
+ fmt.Printf("Could not parse the date you gave me: %s\n", _date)
+ fmt.Println("I'm expecting a date like \"Dec 22\" or \"22 Dec\".")
+ fmt.Println("See http://todolist.site/#adding for more info.")
+ os.Exit(-1)
+ return time.Now()
}
func (p *Parser) monday(day time.Time) string {