Skip to content

Commit

Permalink
add more information to error
Browse files Browse the repository at this point in the history
  • Loading branch information
sensslen committed Oct 30, 2024
1 parent b31cac4 commit c41349f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/NuGetUtility/Wrapper/HttpClientWrapper/FileDownloader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ private async Task<bool> TryDownload(string fileNameStem, Uri url, CancellationT
{
return false;
}
response.EnsureSuccessStatusCode();
if (!response.IsSuccessStatusCode)
{
throw new HttpRequestException($"Failed to download file from {url}. Status code: {response.StatusCode}\nResponse Content:\n{response.Content}");
}

string extension = "html";
if (response.Content.Headers.ContentType?.MediaType == "text/plain")
Expand Down

0 comments on commit c41349f

Please sign in to comment.