geekier_factory 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/geekier_factory/action.rb +3 -3
- data/lib/geekier_factory/version.rb +1 -1
- metadata +1 -1
@@ -72,12 +72,12 @@ module GeekierFactory
|
|
72
72
|
ConnectionException = Class.new(Exception)
|
73
73
|
def handle_response!(response)
|
74
74
|
if error_responses.map{ |er| er['code'] }.include? response.status
|
75
|
-
ex =
|
76
|
-
if ex
|
75
|
+
ex = error_responses.find{ |er| er['code'] == response.status }
|
76
|
+
if ex.has_key?('retry') && (@retries ||= 0) < ex['retry'].to_i
|
77
77
|
@retries += 1
|
78
78
|
raise Retry.new
|
79
79
|
else
|
80
|
-
message = "#{ex[
|
80
|
+
message = "#{ex['reason']} (HTTP status code #{ex['code']})"
|
81
81
|
message = message + "\n\n" + response[:body] if ex['details'] && ex['details'] == 'body'
|
82
82
|
raise ConnectionException.new(message)
|
83
83
|
end
|