misc/plugin/amazon.rb in tdiary-5.1.7 vs misc/plugin/amazon.rb in tdiary-5.2.0
- old
+ new
@@ -183,10 +183,15 @@
@logger.error "amazon.rb: #{e.message}"
message = label || asin
if @mode == 'preview' then
message << %Q|<span class="message">(#{h e.message})</span>|
end
- message
+ # Handle 429 "Too Many Requests"
+ if /^429/ =~ e.message then
+ %Q|<a href="https://www.amazon.co.jp/dp/#{h asin}">https://www.amazon.co.jp/dp/#{h asin}</a>|
+ else
+ message
+ end
rescue NoMethodError
@logger.error "amazon.rb: #{json["Errors"][0]["Message"]}"
message = label || asin
if @mode == 'preview' then
message << %Q|<span class="message">(#{h json["Errors"][0]["Message"]})</span>|