The most basic error is AWSError, which has attributes code and message. Almost all operations raise specialised exceptions.
Generic AWS error message with the following attributes:
- code
- The Amazon error code (e.g. AWS.InvalidEnumeratedParameter)
- msg
- The original error message from Amazon
- xml
- XML returned from Amazon as processed by the API’s result processor
You can (and should) still pass additional arguments to derived exceptions which (as with BaseException) will be stored in args.
Sometimes you may still want to access the original response. An example:
try:
result = api.item_lookup(
['644209004461', '009800895250', '301357583001'], IdType='UPC')
except InvalidParameterValue, e:
print 'There was an invalid ItemId!' # '301357583001'
result = e.xml
Although UPC 301357583001 will cause an error to be raised, you can retrieve the parsed response (here result is simply replaced with e.xml) and continue working on it as if nothing has happened.
Your request contains an invalid AssociateTag, CartId and HMAC combination. Please verify the AssociateTag, CartId, HMAC and retry.
Remember that all Cart operations must pass in the CartId and HMAC that were returned to you during the CartCreate operation.
The specified feature (operation) is deprecated.
Amazon encountered an internal error. Please try again.
Your request contains an invalid value for CartId. Please check your CartId and retry your request.
The item you specified, ???, is not eligible to be added to the cart. Check the item’s availability to make sure it is available.
The AWS Access Key Id you provided does not exist in Amazon’s records.
The value you specified for ListType is invalid. Valid values include: BabyRegistry, Listmania, WeddingRegistry, WishList.
The specified feature (operation) is invalid.
Your request contained a restricted parameter combination.
The specified ItemId parameter is invalid. Please change this value and retry your request.
The specified ResponseGroup parameter is invalid. Valid response groups for ItemLookup requests include:
Accessories, AlternateVersions, BrowseNodes, Collections, EditorialReview, Images, ItemAttributes, ItemIds, Large, ListmaniaLists, Medium, MerchantItemAttributes, OfferFull, OfferListings, OfferSummary, Offers, PromotionDetails, PromotionSummary, PromotionalTag, RelatedItems, Request, Reviews, SalesRank, SearchBins, SearchInside, ShippingCharges, Similarities, Small, Subjects, Tags, TagsSummary, Tracks, VariationImages, VariationMatrix, VariationMinimum, VariationOffers, VariationSummary, Variations.
The value specified for SearchIndex is invalid. Valid values include:
All, Apparel, Automotive, Baby, Beauty, Blended, Books, Classical, DVD, Electronics, ForeignBooks, HealthPersonalCare, HomeGarden, HomeImprovement, Jewelry, Kitchen, Magazines, MP3Downloads, Music, MusicTracks, OfficeProducts, OutdoorLiving, PCHardware, Photo, Shoes, Software, SoftwareVideoGames, SportingGoods, Tools, Toys, VHS, Video, VideoGames, Watches
The item you specified, ???, is already in your cart.
Deprecated since version 0.2.6.
Request must contain AWSAccessKeyId or X.509 certificate.
Your request is missing required parameters. Required parameters include XXX.
We did not find any matches for your request.
When you specify multiple items, it is possible for there to be no intersection of similar items.
Your request should have at least one parameter which you did not submit.
You are submitting requests too quickly and your requests are being throttled. If this is the case, you need to slow your request rate to one request per second.
Raised when unknown locale is specified.