Class: Aws::RpcV2::ErrorHandler Private

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

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.

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

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.



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