From 317f18acf32d19409c3513d49804efec9b613041 Mon Sep 17 00:00:00 2001 From: Javier R Date: Fri, 25 Oct 2024 20:29:56 +0200 Subject: [PATCH] fix: `log` failed sbom request instead of throw --- .../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: