Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: log failed sbom request instead of throw #2418

Merged
merged 1 commit into from
Oct 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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