Skip to content

Just updated and am seeing errors #15

Open
@rlad

Description

Hello, I was using a previous version of this gem and it was working fine, but I just updated and now I am having problems:

  • Previously, when Amazon throttled requests, my app caught that with the following code:
def get_response # takes a block as a parameter
    #amazon requests may be throttled, so we need to check before returning results
    throttled = true
  s = 5
    while throttled == true 
        the_response = yield                                                
        if the_response.has_key?("error_response")                                  # all error responses should have this key
            if the_response.error_response.error.has_key?("code")                   
                if the_response.error_response.error.code == "RequestThrottled"
                    sleep(s.seconds)                                            # throttle times may vary, so retry after 10 sec
          s = s*1.5
                end
            else
                puts "unknown error"
                return nil 
            end
        else
            throttled = false
            return the_response
        end
    end
end

Now, I don't even see the throttled response and instead I get a program crash as follows:

-> "<?xml version=\"1.0\"?>\n<ErrorResponse xmlns=\"https://mws.amazonservices.c
om/Orders/2011-01-01\">\n  <Error>\n    <Type></Type>\n    <Code>RequestThrottle
d</Code>\n    <Message>Request is throttled</Message>\n  </Error>\n  <RequestID>
740e1669-dab8-4776-b8dd-ebf1938c958a</RequestID>\n</ErrorResponse>\n"
read 291 bytes
Conn close
C:/Ruby193/lib/ruby/gems/1.9.1/gems/ruby-mws-0.1/lib/ruby-mws/api/response.rb:24
:in `handle_error_response': RequestThrottled: Request is throttled (MWS::ErrorR
esponse)
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/ruby-mws-0.1/lib/ruby-mws/api/r
esponse.rb:10:in `parse'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/ruby-mws-0.1/lib/ruby-mws/api/b
ase.rb:45:in `send_request'
        from (eval):4:in `list_order_items'
        from mws.rb:98:in `block (2 levels) in <main>'
        from mws.rb:29:in `get_response'
        from mws.rb:98:in `block in <main>'
        from mws.rb:87:in `each'
        from mws.rb:87:in `<main>'

Also:

  • Debug information for every message sent and received is being echoed to the terminal. How do I disable this?

Thanks very much.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions