HttpResponseMessage response = null;
try
{
using (response = await httpClient.PostAsync(requestUri, request).ConfigureAwait(false))
{
if (!response.IsSuccessStatusCode)
{
var data = ToInsightsDataDictionary(requestUri.ToString(), json);
Insights.Report(new ServerException(response), data, Insights.Severity.Critical);
}
}
}
catch (Exception ex)
{
var data = ToInsightsDataDictionary(requestUri.ToString(), json);
Insights.Report(ex, data, Insights.Severity.Critical);
throw;
}
finally
{
response?.Dispose();
}