Class: Aws::RpcV2::ErrorHandler

Inherits:
ErrorHandler show all
Defined in:
lib/aws-sdk-core/rpc_v2/error_handler.rb

Instance Attribute Summary

Attributes inherited from Seahorse::Client::Handler

#handler

Instance Method Summary collapse

Methods inherited from Seahorse::Client::Handler

#initialize, #inspect

Constructor Details

This class inherits a constructor from Seahorse::Client::Handler

Instance Method Details

#call(context) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/aws-sdk-core/rpc_v2/error_handler.rb', line 7

def call(context)
  # Malformed responses should throw an http based error, so we check
  # 200 range for error handling only for this case.
  @handler.call(context).on(200..599) do |response|
    if !valid_response?(context)
      code, message, data = http_status_error(context)
      response.error = build_error(context, code, message, data)
    elsif (300..599).cover?(context.http_response.status_code)
      response.error = error(context)
    end
    response.data = nil
  end
end