From 52c652e4e391af4b7bca6d908c2b616552e15b94 Mon Sep 17 00:00:00 2001 From: Caleb Denio Date: Mon, 17 May 2021 23:07:08 -0400 Subject: [PATCH] Error handling --- pkg/jia/handlers.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pkg/jia/handlers.go b/pkg/jia/handlers.go index e619608..0d2ef89 100644 --- a/pkg/jia/handlers.go +++ b/pkg/jia/handlers.go @@ -73,12 +73,19 @@ func onMessage(slackClient *slack.Client, event *slackevents.MessageEvent) { // Ignore numbers that aren't in order. if matchedNumber != lastValidNumber+1 { - slackClient.AddReaction("bangbang", slack.ItemRef{ + err = slackClient.AddReaction("bangbang", slack.ItemRef{ Channel: event.Channel, Timestamp: event.TimeStamp, }) - slackClient.PostEphemeral(event.Channel, event.User, slack.MsgOptionText( + if err != nil { + log.Println(err) + } + + _, err = slackClient.PostEphemeral(event.Channel, event.User, slack.MsgOptionText( fmt.Sprintf("You counted incorrectly! The next valid number is supposed to be *%d*.", lastValidNumber+1), false)) + if err != nil { + log.Println(err) + } return }