class Aws::Plugins::Retries::ErrorInspector

@api private This class will be obsolete when APIs contain modeled exceptions

Constants

CHECKSUM_ERRORS
CLOCK_SKEW_ERRORS

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

EXPIRED_CREDS
NETWORKING_ERRORS
THROTTLING_ERRORS

Public Class Methods

new(error, http_status_code) click to toggle source
# 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

Public Instance Methods

checksum?() click to toggle source
# File lib/aws-sdk-core/plugins/retries/error_inspector.rb, line 85
def checksum?
  CHECKSUM_ERRORS.include?(@name)
end
clock_skew?(context) click to toggle source
# 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) click to toggle source
# 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?() click to toggle source
# 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?() click to toggle source
# 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?() click to toggle source
# File lib/aws-sdk-core/plugins/retries/error_inspector.rb, line 111
def modeled_throttling?
  @error.is_a?(Errors::ServiceError) && @error.throttling?
end
networking?() click to toggle source
# 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) click to toggle source
# 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?() click to toggle source
# File lib/aws-sdk-core/plugins/retries/error_inspector.rb, line 95
def server?
  (500..599).cover?(@http_status_code)
end
throttling_error?() click to toggle source
# 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

Private Instance Methods

extract_name(error) click to toggle source
# File lib/aws-sdk-core/plugins/retries/error_inspector.rb, line 137
def extract_name(error)
  if error.is_a?(Errors::ServiceError)
    error.class.code || error.class.name.to_s
  else
    error.class.name.to_s
  end
end
refreshable_credentials?(context) click to toggle source
# File lib/aws-sdk-core/plugins/retries/error_inspector.rb, line 133
def refreshable_credentials?(context)
  context.config.credentials.respond_to?(:refresh!)
end