From d1d68552e72f65d52dd57029c217157fdf3d81fa Mon Sep 17 00:00:00 2001 From: Akmal Date: Wed, 14 Aug 2024 15:13:58 +0700 Subject: [PATCH] Fix error logging showed when no error --- handlers/scraper/data.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/handlers/scraper/data.go b/handlers/scraper/data.go index e934b7a..166294c 100644 --- a/handlers/scraper/data.go +++ b/handlers/scraper/data.go @@ -173,7 +173,9 @@ func (i *InstaData) ScrapeData() error { } slog.Error("Failed to scrape data from remote scraper", "postID", i.PostID, "status", res.StatusCode, "err", err) } - slog.Error("Failed when trying to scrape data from remote scraper", "postID", i.PostID, "err", err) + if err != nil { + slog.Error("Failed when trying to scrape data from remote scraper", "postID", i.PostID, "err", err) + } } client := http.Client{Transport: transport, Timeout: timeout}