From 25ca348b59fcf048532c517435d15b81b6537baf Mon Sep 17 00:00:00 2001 From: Kevin Cali <20154415+kevincali@users.noreply.github.com> Date: Wed, 15 May 2024 10:59:17 +0200 Subject: [PATCH] feat: log error --- telegram.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/telegram.go b/telegram.go index 6a002e1..64088d0 100644 --- a/telegram.go +++ b/telegram.go @@ -48,8 +48,12 @@ func (config *Config) initMessage(bot *tgbotapi.BotAPI, configPath string) { if err != nil { log.Fatal(err) } - os.WriteFile(configPath, yamlData, 0644) - log.Printf("%s saved messageId to config", tgPrefix) + err = os.WriteFile(configPath, yamlData, 0644) + if err != nil { + log.Printf("%s unable to save messageId %d to config, %s", tgPrefix, config.Telegram.MessageId, err) + } else { + log.Printf("%s saved messageId %d to config", tgPrefix, config.Telegram.MessageId) + } // pin message pinConfig := tgbotapi.PinChatMessageConfig{