From 714ae541d41638572b03c63b300d6ebf5ecc3e74 Mon Sep 17 00:00:00 2001 From: SpedNSFW <68614336+SpedNSFW@users.noreply.github.com> Date: Tue, 9 Feb 2021 19:04:42 +1100 Subject: [PATCH] fix json unmarshal error return (#1109) --- pkg/scraper/script.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pkg/scraper/script.go b/pkg/scraper/script.go index e8a1ee0af..c7eb5cc85 100644 --- a/pkg/scraper/script.go +++ b/pkg/scraper/script.go @@ -61,6 +61,10 @@ func (s *scriptScraper) runScraperScript(inString string, out interface{}) error // TODO - add a timeout here decodeErr := json.NewDecoder(stdout).Decode(out) + if decodeErr != nil { + logger.Error("could not unmarshal json: " + decodeErr.Error()) + return errors.New("could not unmarshal json: " + decodeErr.Error()) + } stderrData, _ := ioutil.ReadAll(stderr) stderrString := string(stderrData) @@ -73,11 +77,6 @@ func (s *scriptScraper) runScraperScript(inString string, out interface{}) error return errors.New("Error running scraper script") } - if decodeErr != nil { - logger.Errorf("error decoding performer from scraper data: %s", err.Error()) - return errors.New("Error decoding performer from scraper script") - } - return nil }