Exemplo n.º 1
0
 private static void ExceptionHandler(Microsoft.Azure.Documents.DocumentClientException e)
 {
     if ((int)e.StatusCode == 429)
     {
         Console.WriteLine("get 429. sleep for " + e.RetryAfter.ToString());
         System.Threading.Thread.Sleep(e.RetryAfter);
     }
     else
     {
         Console.WriteLine("get exception " + e.Message);
         throw e;
     }
 }
        private static QueryResponseCore CreateFromDocumentClientException(Microsoft.Azure.Documents.DocumentClientException documentClientException)
        {
            CosmosException cosmosException = CosmosExceptionFactory.Create(
                documentClientException,
                null);

            QueryResponseCore queryResponseCore = QueryResponseCore.CreateFailure(
                statusCode: documentClientException.StatusCode.GetValueOrDefault(System.Net.HttpStatusCode.InternalServerError),
                subStatusCodes: null,
                cosmosException: cosmosException,
                requestCharge: 0,
                activityId: documentClientException.ActivityId);

            return(queryResponseCore);
        }