diff --git a/vault_oidc_ssh_cert_action.py b/vault_oidc_ssh_cert_action.py index 0eacb33..5b193a2 100644 --- a/vault_oidc_ssh_cert_action.py +++ b/vault_oidc_ssh_cert_action.py @@ -53,8 +53,14 @@ def _issue_github_jwt(jwt_aud: str) -> str: full_url = f"{req_url}&audience={jwt_aud}" headers = {"Authorization": f"Bearer {req_token}"} - response = requests.get(full_url, headers=headers, timeout=10) - response.raise_for_status() + try: + response = requests.get(full_url, headers=headers, timeout=10) + response.raise_for_status() + except requests.exceptions.RequestException as request_error: + title = "GitHub OIDC JWT token issuing error" + message = f"{type(request_error).__name__}: {str(request_error)}" + _set_error_message(title, message) + raise VoscaError(title) from request_error jwt_token: str = response.json()["value"] return jwt_token