Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

pull response parsing outside of server failure retry loop

  • Loading branch information...
commit 8fc5133c4459574cd4ab32d1872fc2044f2ac3f9 1 parent 325668a
Andrew Benton andrewmbenton authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/twilio-ruby/rest/client.rb
4 lib/twilio-ruby/rest/client.rb
View
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.