Class: Aws::Plugins::Retries::ErrorInspector Private

Inherits:
Object
  • Object
show all
Defined in:
lib/aws-sdk-core/plugins/retries/error_inspector.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

This class will be obsolete when APIs contain modeled exceptions

Constant Summary collapse

EXPIRED_CREDS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Set.new(
  [
    'InvalidClientTokenId',        # query services
    'UnrecognizedClientException', # json services
    'InvalidAccessKeyId',          # s3
    'AuthFailure',                 # ec2
    'InvalidIdentityToken',        # sts
    'ExpiredToken',                # route53
    'ExpiredTokenException'        # kinesis
  ]
)
THROTTLING_ERRORS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Set.new(
  [
    'Throttling',                             # query services
    'ThrottlingException',                    # json services
    'ThrottledException',                     # sns
    'RequestThrottled',                       # sqs
    'RequestThrottledException',              # generic service
    'ProvisionedThroughputExceededException', # dynamodb
    'TransactionInProgressException',         # dynamodb
    'RequestLimitExceeded',                   # ec2
    'BandwidthLimitExceeded',                 # cloud search
    'LimitExceededException',                 # kinesis
    'TooManyRequestsException',               # batch
    'PriorRequestNotComplete',                # route53
    'SlowDown',                               # s3
    'EC2ThrottledException'                   # ec2
  ]
)
CHECKSUM_ERRORS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Set.new(
  [
    'CRC32CheckFailed' # dynamodb
  ]
)
NETWORKING_ERRORS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Set.new(
  [
    'RequestTimeout',          # s3
    'InternalError',           # s3
    'RequestTimeoutException', # glacier
    'IDPCommunicationError'    # sts
  ]
)
CLOCK_SKEW_ERRORS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

See: github.com/aws/aws-sdk-net/blob/5810dfe401e0eac2e59d02276d4b479224b4538e/sdk/src/Core/Amazon.Runtime/Pipeline/RetryHandler/RetryPolicy.cs#L78

Set.new(
  [
    'RequestTimeTooSkewed',
    'RequestExpired',
    'InvalidSignatureException',
    'SignatureDoesNotMatch',
    'AuthFailure',
    'RequestInTheFuture'
  ]
)

Instance Method Summary collapse

Constructor Details

#initialize(error, http_status_code) ⇒ ErrorInspector

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of ErrorInspector.



67
68
69
70
71
# File 'lib/aws-sdk-core/plugins/retries/error_inspector.rb', line 67

def initialize(error, http_status_code)
  @error = error
  @name = extract_name(@error)
  @http_status_code = http_status_code
end

Instance Method Details

#checksum?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


84
85
86
# File 'lib/aws-sdk-core/plugins/retries/error_inspector.rb', line 84

def checksum?
  CHECKSUM_ERRORS.include?(@name) || @error.is_a?(Errors::ChecksumError)
end

#clock_skew?(context) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


114
115
116
117
# File 'lib/aws-sdk-core/plugins/retries/error_inspector.rb', line 114

def clock_skew?(context)
  CLOCK_SKEW_ERRORS.include?(@name) &&
    context.config.clock_skew.clock_skewed?(context)
end

#endpoint_discovery?(context) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


98
99
100
101
102
103
104
# File 'lib/aws-sdk-core/plugins/retries/error_inspector.rb', line 98

def endpoint_discovery?(context)
  return false unless context.operation.endpoint_discovery

  @http_status_code == 421 ||
    @name == 'InvalidEndpointException' ||
    @error.is_a?(Errors::EndpointDiscoveryError)
end

#expired_credentials?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


73
74
75
# File 'lib/aws-sdk-core/plugins/retries/error_inspector.rb', line 73

def expired_credentials?
  !!(EXPIRED_CREDS.include?(@name) || @name.match(/expired/i))
end

#modeled_retryable?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


106
107
108
# File 'lib/aws-sdk-core/plugins/retries/error_inspector.rb', line 106

def modeled_retryable?
  @error.is_a?(Errors::ServiceError) && @error.retryable?
end

#modeled_throttling?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


110
111
112
# File 'lib/aws-sdk-core/plugins/retries/error_inspector.rb', line 110

def modeled_throttling?
  @error.is_a?(Errors::ServiceError) && @error.throttling?
end

#networking?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


88
89
90
91
92
# File 'lib/aws-sdk-core/plugins/retries/error_inspector.rb', line 88

def networking?
  @error.is_a?(Seahorse::Client::NetworkingError) ||
    @error.is_a?(Errors::NoSuchEndpointError) ||
    NETWORKING_ERRORS.include?(@name)
end

#retryable?(context) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


119
120
121
122
123
124
125
126
127
128
# File 'lib/aws-sdk-core/plugins/retries/error_inspector.rb', line 119

def retryable?(context)
  server? ||
    modeled_retryable? ||
    throttling_error? ||
    networking? ||
    checksum? ||
    endpoint_discovery?(context) ||
    (expired_credentials? && refreshable_credentials?(context)) ||
    clock_skew?(context)
end

#server?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


94
95
96
# File 'lib/aws-sdk-core/plugins/retries/error_inspector.rb', line 94

def server?
  (500..599).cover?(@http_status_code)
end

#throttling_error?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


77
78
79
80
81
82
# File 'lib/aws-sdk-core/plugins/retries/error_inspector.rb', line 77

def throttling_error?
  !!(THROTTLING_ERRORS.include?(@name) ||
    @name.match(/throttl/i) ||
    @http_status_code == 429) ||
    modeled_throttling?
end