Amazon.S3.Internal.AmazonS3RetryPolicy.RetryForException C# (CSharp) Метод

RetryForException() публичный Метод

Return true if the request should be retried. Implements additional checks specific to S3 on top of the checks in DefaultRetryPolicy.
public RetryForException ( Runtime executionContext, Exception exception ) : bool
executionContext Runtime Request context containing the state of the request.
exception System.Exception The exception thrown by the previous request.
Результат bool
        public override bool RetryForException(Runtime.IExecutionContext executionContext, Exception exception)
        {
            var syncResult = RetryForExceptionSync(executionContext, exception);
            if (syncResult.HasValue)
            {
                return syncResult.Value;
            }
            else
            {
                var serviceException = exception as AmazonServiceException;
                string correctedRegion = null;
                AmazonS3Uri s3BucketUri;
                if (AmazonS3Uri.TryParseAmazonS3Uri(executionContext.RequestContext.Request.Endpoint, out s3BucketUri))
                {
                    var credentials = executionContext.RequestContext.ImmutableCredentials;
                    if (credentials != null)
                    {
                        correctedRegion = BucketRegionDetector.DetectMismatchWithHeadBucketFallback(s3BucketUri, serviceException, credentials);
                    }
                }

                if (correctedRegion == null)
                {
                    return base.RetryForException(executionContext, exception);
                }
                else
                {
                    // change authentication region of request and signal the handler to sign again with the new region
                    executionContext.RequestContext.Request.AuthenticationRegion = correctedRegion;
                    executionContext.RequestContext.IsSigned = false;
                    return true;
                }
            }
        }
    }