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
    'BadDigest' # s3
  ]
)
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.



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

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)


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

def checksum?
  CHECKSUM_ERRORS.include?(@name)
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)


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

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)


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

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)


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

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)


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

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)


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

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)


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

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)


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

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)


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

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)


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

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