Skip to content

Instantly share code, notes, and snippets.

@czottmann
Created February 4, 2009 15:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save czottmann/58145 to your computer and use it in GitHub Desktop.
Save czottmann/58145 to your computer and use it in GitHub Desktop.
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