Skip to content

Commit

Permalink
Handle not OK HTTP status codes in HealthCheckReportCollector (#1963)
Browse files Browse the repository at this point in the history
  • Loading branch information
sungam3r authored Jul 30, 2023
1 parent ad669d3 commit 7d09f94
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ private async Task<UIHealthReport> GetHealthReportAsync(HealthCheckConfiguration

using (response)
{
if (!response.IsSuccessStatusCode)
return UIHealthReport.CreateFrom(new InvalidOperationException($"HTTP response is not in valid state ({response.StatusCode}) when trying to get report from {uri} configured with name {name}."));

return await response.Content.ReadFromJsonAsync<UIHealthReport>(_options)
?? throw new InvalidOperationException($"{nameof(HttpContentJsonExtensions.ReadFromJsonAsync)} returned null");
}
Expand Down

0 comments on commit 7d09f94

Please sign in to comment.