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); }
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)); }