From 98cec7bc531c3aa94f208f645be8cc1dd5e8add6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20R=C3=ADos?= Date: Fri, 25 Oct 2024 11:58:04 -0700 Subject: [PATCH] fix: `log` failed sbom request instead of throw (#2418) --- .../dlt_sources/github_repos/__init__.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/warehouse/oso_dagster/dlt_sources/github_repos/__init__.py b/warehouse/oso_dagster/dlt_sources/github_repos/__init__.py index 619d76c0..9ef63175 100644 --- a/warehouse/oso_dagster/dlt_sources/github_repos/__init__.py +++ b/warehouse/oso_dagster/dlt_sources/github_repos/__init__.py @@ -293,9 +293,9 @@ def is_repo_missing_sbom(self, repo: Repository) -> bool: ) return False except RequestFailed as e: - if e.response.status_code == 404: - return True - raise e + if e.response.status_code != 404: + logger.warning("Error checking for SBOM: %s", e) + return True def get_sbom_for_repo(self, repo: Repository) -> List[GithubRepositorySBOMItem]: try: @@ -330,9 +330,10 @@ def get_sbom_for_repo(self, repo: Repository) -> List[GithubRepositorySBOMItem]: return sbom_list except RequestFailed as exception: if exception.response.status_code == 404: - logging.warning("Skipping %s, no SBOM found", repo.url) - return [] - raise exception + logger.warning("Skipping %s, no SBOM found", repo.url) + else: + logger.warning("Error getting SBOM: %s", exception) + return [] @staticmethod def get_github_client(config: GithubClientConfig) -> GitHub: