Skip to content

Commit 250b858

Browse files
committed
[OJ-54730] Catch HTTPError when fetching BB Cloud PR merge commit
Mirrors the existing pattern in jf_github/adapters/bitbucket_cloud.py so a garbage-collected merge commit returns merge_commit=None instead of skipping the entire PR.
1 parent 3b11938 commit 250b858

1 file changed

Lines changed: 14 additions & 10 deletions

File tree

jf_agent/git/bitbucket_cloud_adapter.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -514,16 +514,20 @@ def _standardize_pr(
514514
and api_pr['merge_commit']
515515
and api_pr['merge_commit'].get('hash')
516516
):
517-
api_merge_commit = client.get_commit(
518-
repo.project.id, repo_slug, api_pr['merge_commit']['hash']
519-
)
520-
merge_commit = _standardize_commit(
521-
api_merge_commit,
522-
repo,
523-
api_pr['destination']['branch']['name'],
524-
strip_text_content,
525-
redact_names_and_urls,
526-
)
517+
merge_commit_hash = api_pr['merge_commit']['hash']
518+
try:
519+
api_merge_commit = client.get_commit(repo.project.id, repo_slug, merge_commit_hash)
520+
merge_commit = _standardize_commit(
521+
api_merge_commit,
522+
repo,
523+
api_pr['destination']['branch']['name'],
524+
strip_text_content,
525+
redact_names_and_urls,
526+
)
527+
except requests.exceptions.HTTPError as e:
528+
logger.info(
529+
f'For merge commit {merge_commit_hash} received a {e.response.status_code} while retrieving PR commits'
530+
)
527531

528532
# Repo links
529533
base_repo = _standardize_short_form_repo(

0 commit comments

Comments
 (0)