From 7068ecbc617b1890ec398d1036ba0c1819334eb1 Mon Sep 17 00:00:00 2001 From: Charlie Egan Date: Tue, 26 Oct 2021 07:19:43 +0100 Subject: [PATCH] Error if pushover credentials unset Signed-off-by: Charlie Egan --- cmd/week.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cmd/week.go b/cmd/week.go index 41e5570..b81ec0a 100644 --- a/cmd/week.go +++ b/cmd/week.go @@ -41,9 +41,12 @@ var weekCmd = &cobra.Command{ pushoverRecipient := psh.NewRecipient(viper.GetString("pushover.user_key")) pushoverApp := psh.New(viper.GetString("pushover.app_token")) if alert { - pushover.Notify(pushoverApp, pushoverRecipient, fmt.Sprintf("Weekly Summary (%s)", title), message) + err = pushover.Notify(pushoverApp, pushoverRecipient, fmt.Sprintf("Weekly Summary (%s)", title), message) } else { - pushover.Notify(pushoverApp, pushoverRecipient, "No Events", "There are no events in the next two weeks") + err = pushover.Notify(pushoverApp, pushoverRecipient, "No Events", "There are no events in the next two weeks") + } + if err != nil { + log.Fatalf("failed to send message: %s", err) } }, }