protected override bool CheckIsTransient(Exception ex)
        {
            bool returnValue = false;

            try
            {
                var dataServiceException = ex.FindInnerException <DataServiceRequestException>();

                if ((dataServiceException != null) && (dataServiceException.Response != null))
                {
                    if (dataServiceException.Response.IsBatchResponse)
                    {
                        returnValue = CommonRetryableWebExceptions.Any(s => (int)s == dataServiceException.Response.BatchStatusCode);
                    }
                    else
                    {
                        // If this isn't a batch response we have to check the StatusCode on the Response object itself
                        var responses = dataServiceException.Response.ToList();

                        if (responses.Count == 1)
                        {
                            returnValue = CommonRetryableWebExceptions.Any(s => (int)s == responses[0].StatusCode);
                        }
                    }
                }
            }
            catch (Exception)
            {
                // we don't want to hide the original exception with any errors we might generate here
                // so just swallow the exception and don't retry
                returnValue = false;
            }

            return(returnValue);
        }
Пример #2
0
        protected override bool CheckIsTransient(Exception ex)
        {
            var dataServiceException = ex.FindInnerException <DataServiceQueryException>();

            if (dataServiceException == null)
            {
                return(false);
            }

            return(CommonRetryableWebExceptions.Any(s => dataServiceException.Response != null && (int)s == dataServiceException.Response.StatusCode));
        }
Пример #3
0
        protected override bool CheckIsTransient(Exception ex)
        {
            var webException = ex.FindInnerException <WebException>();

            if (webException != null &&
                CommonRetryableWebExceptions.Contains(webException.Status))
            {
                return(true);
            }

            if (ex.FindInnerException <TimeoutException>() != null)
            {
                return(true);
            }

            return(false);
        }