From ec5c14d2cd91866ec6eae1bf2fa9b734e5fdcf10 Mon Sep 17 00:00:00 2001 From: Gregory Rudolph Date: Thu, 17 Oct 2019 10:31:51 -0400 Subject: [PATCH] Better error handling --- cmdReply.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cmdReply.go b/cmdReply.go index 98ec995..aa2c231 100644 --- a/cmdReply.go +++ b/cmdReply.go @@ -3,6 +3,7 @@ package main import ( + "fmt" "strconv" "strings" ) @@ -20,8 +21,11 @@ func init() { func cmdReply(cmd []string) { chat := k.NewChat(channel) - messageId, err := strconv.Atoi(cmd[1]) - _, err = chat.Reply(messageId, strings.Join(cmd[2:], " ")) + messageID, err := strconv.Atoi(cmd[1]) + if err != nil { + printToView("Feed", fmt.Sprintf("There was an error determining message ID %s", cmd[1])) + } + _, err = chat.Reply(messageID, strings.Join(cmd[2:], " ")) if err != nil { printToView("Feed", "There was an error with your reply.") }