protected override bool CanRetrySqlException(SqlException sqlException)
            {
                // Enumerate through all errors found in the exception.
                foreach (SqlError err in sqlException.Errors)
                {
                    RetryPolicyUtils.AppendThrottlingDataIfIsThrottlingError(sqlException, err);
                    if (RetryPolicyUtils.IsNonRetryableDataTransferError(err.Number))
                    {
                        Logger.Write(TraceEventType.Error, string.Format(Resources.ExceptionCannotBeRetried, err.Number, err.Message));
                        return(false);
                    }
                }

                // Default is to treat all SqlException as retriable.
                return(true);
            }
Example #2
0
            protected override bool CanRetrySqlException(SqlException sqlException)
            {
                // Enumerate through all errors found in the exception.
                bool foundRetryableError = false;

                foreach (SqlError err in sqlException.Errors)
                {
                    RetryPolicyUtils.AppendThrottlingDataIfIsThrottlingError(sqlException, err);
                    if (!RetryPolicyUtils.IsRetryableAzureError(err.Number))
                    {
                        // If any error is not retryable then cannot retry
                        return(false);
                    }
                    foundRetryableError = true;
                }
                return(foundRetryableError);
            }