Merge pull request #153 from rcuhljr/better-error-message

Better error message
This commit is contained in:
Chris Sexton 2019-02-20 15:08:13 -05:00 committed by GitHub
commit f818acc55c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -88,7 +88,7 @@ func (p *ReminderPlugin) message(kind bot.Kind, message msg.Message, args ...int
dur, err := time.ParseDuration(parts[3])
if err != nil {
p.Bot.Send(bot.Message, channel, "Easy cowboy, not sure I can parse that duration.")
p.Bot.Send(bot.Message, channel, "Easy cowboy, not sure I can parse that duration. Try something like '1.5h' or '2h45m'.")
return true
}
@ -116,7 +116,7 @@ func (p *ReminderPlugin) message(kind bot.Kind, message msg.Message, args ...int
//remind who every dur for dur2 blah
dur2, err := time.ParseDuration(parts[5])
if err != nil {
p.Bot.Send(bot.Message, channel, "Easy cowboy, not sure I can parse that duration.")
p.Bot.Send(bot.Message, channel, "Easy cowboy, not sure I can parse that duration. Try something like '1.5h' or '2h45m'.")
return true
}

View File

@ -77,7 +77,7 @@ func TestReminderParse(t *testing.T) {
res := c.message(makeMessage("!remind testuser in unparseable don't fail this test"))
assert.Len(t, mb.Messages, 1)
assert.True(t, res)
assert.Contains(t, mb.Messages[0], "Easy cowboy, not sure I can parse that duration.")
assert.Contains(t, mb.Messages[0], "Easy cowboy, not sure I can parse that duration. Try something like '1.5h' or '2h45m'.")
}
func TestEmptyList(t *testing.T) {