From a3349fe7b192aa919a538d694be60dd49783cde9 Mon Sep 17 00:00:00 2001 From: Seraphim Strub Date: Sun, 23 Apr 2023 00:51:02 +0200 Subject: [PATCH] adds logging to sentry of api failled api calls --- cmd/dealsbot/main.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cmd/dealsbot/main.go b/cmd/dealsbot/main.go index d499c8e..168257e 100644 --- a/cmd/dealsbot/main.go +++ b/cmd/dealsbot/main.go @@ -50,8 +50,6 @@ func main() { // Flush buffered events before the program terminates. defer sentry.Flush(2 * time.Second) - sentry.CaptureMessage("DEBUG: dealsbot started") - log.Printf("INFO: starting dealsbot...") log.Printf("INFO: disgo version: %v", disgo.Version) @@ -71,15 +69,16 @@ func main() { case <-ticker.C: var apis []api.Api apis = append(apis, api.NewUbsioftApi(), api.NewEpicApi(), api.NewSteamApi(), api.NewGogApi(), api.NewHumbleBundleApi()) - for _, api := range apis { - err := api.Load() + for _, a := range apis { + err := a.Load() if err != nil { + sentry.CaptureException(fmt.Errorf("ERROR: loading from api: %w", err)) log.Printf("ERROR: %v", err) } } var deals []api.Deal - for _, api := range apis { - apiDeals := api.Get() + for _, a := range apis { + apiDeals := a.Get() deals = append(deals, apiDeals...) } @@ -116,6 +115,7 @@ func main() { }() log.Printf("INFO: dealsbot is now running. Press CTRL-C to exit.") + sentry.CaptureMessage("DEBUG: dealsbot started") s := make(chan os.Signal, 1) signal.Notify(s, syscall.SIGINT, syscall.SIGTERM, os.Interrupt) <-s