lib/awsbase/right_awsbase.rb
# All services uses this guy.
All services uses this guy.
All services uses this guy .
def request_info_impl(aws_service, benchblock, request, parser, &block) 
      request[:aws_service] = aws_service
      @connection    = get_connection(request)
      @last_request  = request[:request]
      @last_response = nil
      response = nil
      blockexception = nil
      if(block != nil)
        benchblock.service.add! do
          begin
            responsehdr = @connection.request(request) do |response|
              begin
                @last_response = response
                if response.is_a?(Net::HTTPSuccess)
                  @error_handler = nil
                  response.read_body(&block)
                else
                  @error_handler = AWSErrorHandler.new(self, parser, :errors_list => self.class.amazon_problems) unless @error_handler
                  check_result   = @error_handler.check(request)
                  if check_result
                    @error_handler = nil
                    return check_result
                  end
                  raise AwsError.new(@last_errors, @last_response.code, @last_request_id)
                end
              rescue Exception => e
                blockexception = e
              end
            end
          rescue Exception => e
            destroy_connection(request, "error: #{e.message}")
            raise e
          end
          if(blockexception)
            raise blockexception
          end
          benchblock.xml.add! do
            parser.parse(responsehdr)
          end
          return parser.result
        end
      else
        benchblock.service.add! do
          begin
            response = @connection.request(request)
          rescue Exception => e
            destroy_connection(request, "error: #{e.message}")
            raise e
          end
        end
        @last_response = response
        if response.is_a?(Net::HTTPSuccess)
          @error_handler = nil
          benchblock.xml.add! { parser.parse(response) }
          return parser.result
        else
          @error_handler = AWSErrorHandler.new(self, parser, :errors_list => self.class.amazon_problems) unless @error_handler
          check_result   = @error_handler.check(request)
          if check_result
            @error_handler = nil
            return check_result 
          end
          raise AwsError.new(@last_errors, @last_response.code, @last_request_id)
        end
      end
    rescue
      @error_handler = nil
      raise
    end
def request_info_impl ( aws_service , benchblock , request , parser , & block ) request [ :aws_service ] = aws_service @connection = get_connection ( request ) @last_request = request [ :request ] @last_response = nil response = nil blockexception = nil if ( block != nil ) benchblock . service . add! do begin responsehdr = @connection . request ( request ) do | response | begin @last_response = response if response . is_a? ( Net :: HTTPSuccess ) @error_handler = nil response . read_body ( & block ) else @error_handler = AWSErrorHandler . new ( self , parser , :errors_list => self . class . amazon_problems ) unless @error_handler check_result = @error_handler . check ( request ) if check_result @error_handler = nil return check_result end raise AwsError . new ( @last_errors , @last_response . code , @last_request_id ) end rescue Exception => e blockexception = e end end rescue Exception => e destroy_connection ( request , "error: #{e.message}" ) raise e end if ( blockexception ) raise blockexception end benchblock . xml . add! do parser . parse ( responsehdr ) end return parser . result end else benchblock . service . add! do begin response = @connection . request ( request ) rescue Exception => e destroy_connection ( request , "error: #{e.message}" ) raise e end end @last_response = response if response . is_a? ( Net :: HTTPSuccess ) @error_handler = nil benchblock . xml . add! { parser . parse ( response ) } return parser . result else @error_handler = AWSErrorHandler . new ( self , parser , :errors_list => self . class . amazon_problems ) unless @error_handler check_result = @error_handler . check ( request ) if check_result @error_handler = nil return check_result end raise AwsError . new ( @last_errors , @last_response . code , @last_request_id ) end end rescue @error_handler = nil raise end
All services uses this guy.
All services uses this guy .
#:nodoc: # TRB 9/17/07 Careful - because we are passing in blocks, we get a situation where # an exception may get thrown in the block body (which is high-level # code either here or in the application) but gets caught in the # low-level code of HttpConnection.  The solution is not to let any # exception escape the block that we pass to HttpConnection::request. # Exceptions can originate from code directly in the block, or from user # code called in the other block which is passed to response.read_body. ######### # Kill a connection if we run into a low level connection error ######### #OK, now we are out of the block passed to the lower level # Kill a connection if we run into a low level connection error # check response for errors...
aws_service
<not_specific>
benchblock
<not_specific>
request
<not_specific>
parser
<not_specific>
block
<not_specific>