Skip to content

Commit

Permalink
fix: add log for url on retry failure (#613)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasrockhu-codecov authored Feb 5, 2025
1 parent 613107a commit 0728eb0
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion codecov_cli/helpers/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def wrapper(*args, **kwargs):
)
sleep(backoff_time(retry))
retry += 1
raise Exception("Request failed after too many retries")
raise Exception(f"Request failed after too many retries. URL: {kwargs.get('url', args[0] if args else 'Unknown')}")

return wrapper

Expand Down
2 changes: 1 addition & 1 deletion tests/helpers/test_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def test_request_retry_too_many_errors(mocker):
)
with pytest.raises(Exception) as exp:
_ = send_post_request("my_url")
assert str(exp.value) == "Request failed after too many retries"
assert str(exp.value) == "Request failed after too many retries. URL: my_url"


def test_user_agent(mocker):
Expand Down
1 change: 0 additions & 1 deletion tests/helpers/test_upload_sender.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,6 @@ def test_upload_sender_result_fail_post_500s(
matcher = re.compile(
rf"(warning.*((Response status code was {error_code})|(Request failed\. Retrying)).*(\n)?){{6}}"
)

assert matcher.match(capsys.readouterr().err) is not None

def test_upload_sender_result_fail_put_400(
Expand Down

0 comments on commit 0728eb0

Please sign in to comment.