From a3f6d7f1a66f4d8830a5419acaa06931a72c7054 Mon Sep 17 00:00:00 2001 From: lvalerom Date: Mon, 9 Dec 2024 13:33:55 +0100 Subject: [PATCH] fix error handling in the azure crawler --- pkg/crawlers/azure/azure.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/crawlers/azure/azure.go b/pkg/crawlers/azure/azure.go index 5eb3289..1ae0759 100644 --- a/pkg/crawlers/azure/azure.go +++ b/pkg/crawlers/azure/azure.go @@ -279,9 +279,12 @@ func (c *azureNetworkCrawler) fetchAll() ([][]byte, error) { jsonURLs := make([]string, 0, len(c.urls)) for _, url := range c.urls { jsonURL, err := c.redirectToJSONURL(url) - if err != nil || jsonURL == "" { + if err != nil { return nil, errors.Wrapf(err, "failed to crawl Azure with URL: %s. Error: %v. JSON URL: %s", url, err, jsonURL) } + if jsonURL == "" { + return nil, errors.Errorf("failed to crawl Azure with URL: %s, empty JSON URL returned. This could indicate Azure's services are unavailable", url) + } log.Printf("Received Azure network JSON URL: %s", jsonURL) jsonURLs = append(jsonURLs, jsonURL) }