Skip to content

Commit

Permalink
fix: log failed sbom request instead of throw (#2418)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jabolol authored Oct 25, 2024
1 parent 6d91f4a commit 98cec7b
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions warehouse/oso_dagster/dlt_sources/github_repos/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 98cec7b

Please sign in to comment.