sdk/dotnet/src/Microsoft.Datasync.Client/Http/ServiceHttpClient.cs
/// <summary>
/// throws an exception for an invalid response to a request.
/// </summary>
/// <param name="request">The request.</param>
/// <param name="response">The response.</param>
/// <param name="cancellationToken">A <see cref="CancellationToken"/> to observe.</param>
/// <returns>The exception to throw.</returns>
throws an exception for an invalid response to a request.
throws an exception for an invalid response to a request .
private static async Task<Exception> ThrowInvalidResponseAsync(HttpRequestMessage request, HttpResponseMessage response, CancellationToken cancellationToken = default)
        {
            Arguments.IsNotNull(request, nameof(request));
            Arguments.IsNotNull(response, nameof(response));
            string responseContent = !response.HasContent() ? null : await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
            string message = GetErrorMessageFromBody(responseContent) ?? $"The request could not be completed ({response.ReasonPhrase})";
            return new DatasyncInvalidOperationException(message, request, response);
        }
private static async Task < Exception > ThrowInvalidResponseAsync ( HttpRequestMessage request , HttpResponseMessage response , CancellationToken cancellationToken = default ) { Arguments . IsNotNull ( request , nameof ( request ) ) ; Arguments . IsNotNull ( response , nameof ( response ) ) ; string responseContent = ! response . HasContent ( ) ? null : await response . Content . ReadAsStringAsync ( cancellationToken ) . ConfigureAwait ( false ) ; string message = GetErrorMessageFromBody ( responseContent ) ?? $" The request could not be completed ( { response . ReasonPhrase } ) " ; return new DatasyncInvalidOperationException ( message , request , response ) ; }
throws an exception for an invalid response to a request.
throws an exception for an invalid response to a request .
The exception to throw.
The exception to throw .
request
HttpRequestMessage
None
response
HttpResponseMessage
None
cancellationToken
CancellationToken
A  to observe.
A to observe .