public Task <ShouldRetryResult> ShouldRetryAsync(
            CosmosResponseMessage httpResponseMessage,
            CancellationToken cancellationToken)
        {
            Debug.Assert(this.nextPolicy == null);
            return(this.ShouldRetryAsyncInternal(
                       httpResponseMessage.StatusCode,
                       httpResponseMessage.Headers.SubStatusCode,
                       httpResponseMessage.GetResourceAddress(),

                       // In the new OM, retries are chained by handlers, not by chaining retry policies. Consequently, the next policy should be null here.
                       continueIfNotHandled: null));
        }
        public Task <ShouldRetryResult> ShouldRetryAsync(
            CosmosResponseMessage httpResponseMessage,
            CancellationToken cancellationToken)
        {
            ShouldRetryResult shouldRetryResult = this.ShouldRetryInternal(
                httpResponseMessage.StatusCode,
                httpResponseMessage.Headers.SubStatusCode,
                httpResponseMessage.GetResourceAddress());

            if (shouldRetryResult != null)
            {
                return(Task.FromResult(shouldRetryResult));
            }

            return(this.nextPolicy != null?this.nextPolicy.ShouldRetryAsync(httpResponseMessage, cancellationToken) : Task.FromResult(ShouldRetryResult.NoRetry()));
        }