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


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

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)

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

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)

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

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)

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

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)

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

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)

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

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)

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

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)

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

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)

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

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)

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

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)

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

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