From ec8ce42abb3e488c1925aff50c0bec16aacfc40f Mon Sep 17 00:00:00 2001 From: Robert Uhl Date: Wed, 20 Feb 2019 14:16:55 -0500 Subject: [PATCH 1/2] Add example text for time parse errors --- plugins/reminder/reminder.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/reminder/reminder.go b/plugins/reminder/reminder.go index 26078a8..715ba68 100644 --- a/plugins/reminder/reminder.go +++ b/plugins/reminder/reminder.go @@ -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 } From 44bf5b43a1cda0cb6d057953caa0f34c1b5e27fe Mon Sep 17 00:00:00 2001 From: Robert Uhl Date: Wed, 20 Feb 2019 14:17:45 -0500 Subject: [PATCH 2/2] Update Tests --- plugins/reminder/reminder_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/reminder/reminder_test.go b/plugins/reminder/reminder_test.go index 3618f16..457397d 100644 --- a/plugins/reminder/reminder_test.go +++ b/plugins/reminder/reminder_test.go @@ -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) {