Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
begin
retryable( :tries => 2 ) do
Timeout::timeout(5) do |t|
xml_string = open( my_url, "User-Agent" => "Firefox/2.0" ).read
end
end
rescue Timeout::Error
LOG.error("Timeout error: #{$!} (#{my_url})")
rescue OpenURI::HTTPError
LOG.error("HTTP error: #{$!} (#{my_url})")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.