fix: Use checked exception KeyError for missing key

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
Luca Simone
2023-11-16 10:59:01 +01:00
committed by GitHub
parent eae30c32a2
commit d78a71184d

View File

@ -23,7 +23,7 @@ class BitbucketServerProvider(GitProvider):
try:
bearer = context.get("bitbucket_bearer_token", None)
s.headers["Authorization"] = f"Bearer {bearer}"
except Exception:
except KeyError:
s.headers[
"Authorization"
] = f'Bearer {get_settings().get("BITBUCKET.BEARER_TOKEN", None)}'