Skip to content

Commit 6dee118

Browse files
author
Bogdan Gavril
committed
SONARMSBRU-152: Print the HTTP error code and the reason phrase in an error message.
1 parent d1d1235 commit 6dee118

File tree

4 files changed

+18
-4
lines changed

4 files changed

+18
-4
lines changed

SonarQube.MSBuild.Runner.sln

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ EndProject
4646
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "V0_9UpgradeMessageExe", "V0_9UpgradeMessageExe\V0_9UpgradeMessageExe.csproj", "{D35AF999-A91E-4DE2-93D7-858DFB4DD063}"
4747
EndProject
4848
Global
49-
GlobalSection(Performance) = preSolution
50-
HasPerformanceSessions = true
51-
EndGlobalSection
5249
GlobalSection(SolutionConfigurationPlatforms) = preSolution
5350
Debug|Any CPU = Debug|Any CPU
5451
Debug|Mixed Platforms = Debug|Mixed Platforms

SonarQube.TeamBuild.Integration/CoverageReportDownloader.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,10 @@ public bool DownloadReport(string tfsUri, string reportUrl, string newFullFileNa
4747
private void InternalDownloadReport(string tfsUri, string reportUrl, string reportDestinationPath, ILogger logger)
4848
{
4949
VssHttpMessageHandler vssHttpMessageHandler = GetHttpHandler(tfsUri, logger);
50-
HttpClient httpClient = new HttpClient(vssHttpMessageHandler);
5150

5251
logger.LogInfo(Resources.DOWN_DIAG_DownloadCoverageReportFromTo, reportUrl, reportDestinationPath);
52+
53+
using (HttpClient httpClient = new HttpClient(vssHttpMessageHandler))
5354
using (HttpResponseMessage response = httpClient.GetAsync(reportUrl).Result)
5455
{
5556
if (response.IsSuccessStatusCode)
@@ -59,6 +60,10 @@ private void InternalDownloadReport(string tfsUri, string reportUrl, string repo
5960
response.Content.CopyToAsync(fileStream).Wait();
6061
}
6162
}
63+
else
64+
{
65+
logger.LogError(Resources.PROC_ERROR_FailedToDownloadReportReason, reportUrl, response.StatusCode, response.ReasonPhrase);
66+
}
6267
}
6368
}
6469

SonarQube.TeamBuild.Integration/Resources.Designer.cs

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

SonarQube.TeamBuild.Integration/Resources.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,9 @@ Check that the downloaded code coverage file ({0}) is valid by opening it in Vis
158158
<data name="PROC_ERROR_FailedToDownloadReport" xml:space="preserve">
159159
<value>Failed to download the code coverage report.</value>
160160
</data>
161+
<data name="PROC_ERROR_FailedToDownloadReportReason" xml:space="preserve">
162+
<value>"Failed to download the code coverage report from {0}. The HTTP status code was {1} and the reason \"{2}\""</value>
163+
</data>
161164
<data name="PROC_ERROR_MultipleCodeCoverageReportsFound" xml:space="preserve">
162165
<value>More than one code coverage result file was created. Only one report can be uploaded to SonarQube. Please modify the build definition so either SonarQube analysis is disabled or only one platform/flavor is built</value>
163166
</data>

0 commit comments

Comments
 (0)