Skip to content

Handle Amazon Product API errors #171

@leesharma

Description

@leesharma

I'm breaking this out of #56 since it's really a different issue.

The Issue

Sometimes, Amazon queries return errors. The current behavior is that the page stays blank. We should have a graceful way of handling this that gives some clue about the problem.

Here are the errors I've encountered so far (to give a sense of how they look):

  •  "Error"=>{"Code"=>"SignatureDoesNotMatch", "Message"=>"The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details."}
  •  "Error"=>{"Code"=>"RequestThrottled", "Message"=>"AWS Access Key ID: <redacted>. You are submitting requests too quickly. Please retry your requests at a slower rate."}
  •  "Error"=>{"Code"=>"AWS.InvalidParameterValue", "Message"=>"{:ASIN=>\"B00TFT77ZS\"} is not a valid value for ItemId. Please change this value and retry your request."}}

And here's an example error response for the ItemLookup endpoint: gist

Reproducing the Issue

The easiest error to reproduce: search for an item with a ' character (ex. k'nex) (until #56 is solved).

Task

We should handle Amazon error responses in a generic way. Maybe re-render the search page with an flash alert? Display a different error page?

We should also make sure any sensitive data (ex. keys) are redacted from the displayed messages.

Do any of these errors need special handling? I assume the Amazon API docs list all possible errors.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions