in src/Microsoft.Azure.NotificationHubs/NamespaceManager.cs [703:740]
private async Task<HttpResponseMessage> SendAsync(Func<HttpRequestMessage> generateHttpRequestMessage, CancellationToken cancellationToken)
{
var trackingId = Guid.NewGuid().ToString();
var httpRequestMessage = generateHttpRequestMessage();
httpRequestMessage.Headers.Add(TrackingIdHeaderKey, trackingId);
try
{
var response = await _httpClient.SendAsync(httpRequestMessage, cancellationToken).ConfigureAwait(false);
response.Headers.Add(TrackingIdHeaderKey, trackingId);
if (response.IsSuccessStatusCode)
{
return response;
}
else
{
throw await response.TranslateToMessagingExceptionAsync(trackingId).ConfigureAwait(false);
}
}
catch (HttpRequestException ex)
{
var innerException = ex.GetBaseException();
if (innerException is SocketException socketException)
{
throw ExceptionsUtility.HandleSocketException(socketException, OperationTimeout.Milliseconds, trackingId);
}
else
{
throw ExceptionsUtility.HandleUnexpectedException(ex, trackingId);
}
}
catch (XmlException ex)
{
throw ExceptionsUtility.HandleXmlException(ex, trackingId);
}
}