Skip to content

Instantly share code, notes, and snippets.

@rebyn
Created April 19, 2015 08:26
Show Gist options
  • Save rebyn/db783ab060a072d25249 to your computer and use it in GitHub Desktop.
Save rebyn/db783ab060a072d25249 to your computer and use it in GitHub Desktop.
# Before
def self.send_request_to_path(request)
request.execute(target_base_url)
rescue Intercom::ServiceUnavailableError => e
if endpoints.length > 1
retry_on_alternative_endpoint(request)
else
raise e
end
end
# After
def self.send_request_to_path(request)
request.execute(target_base_url)
rescue Intercom::ServiceUnavailableError
raise unless endpoints.length > 1
retry_on_alternative_endpoint(request)
end
@voanhduy1512
Copy link

👍 for refactored version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment