Skip to content

Commit

Permalink
pull response parsing outside of server failure retry loop
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewmbenton committed May 2, 2012
1 parent 325668a commit 8fc5133
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/twilio-ruby/rest/client.rb
Expand Up @@ -212,13 +212,13 @@ def connect_and_send(request) # :doc:
begin
response = @connection.request request
@last_response = response
object = MultiJson.load response.body if response.body
if response.kind_of? Net::HTTPServerError
raise Twilio::REST::ServerError, object['message']
raise Twilio::REST::ServerError
end
rescue Exception
if retries_left > 0 then retries_left -= 1; retry else raise end
end
object = MultiJson.load response.body if response.body
if response.kind_of? Net::HTTPClientError
raise Twilio::REST::RequestError.new object['message'], object['code']
end
Expand Down

0 comments on commit 8fc5133

Please sign in to comment.