35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
# File 'lib/fun_with/files/downloader.rb', line 35
def handle_network_errors( e )
raise e
rescue URI::InvalidURIError => e
puts "Tried to get #{@uri.path} but failed with URI::InvalidURIError."
rescue OpenURI::HTTPError => e
STDERR.write( "Couldn't fetch podcast info from #{@uri.path}\n" )
STDERR.write( "#{e}\n\n" )
rescue SocketError => e
STDERR.write( "Problem connecting to server (Socket error) when downloading #{@uri.path}." )
STDERR.write( "#{e}\n\n" )
rescue URI::InvalidURIError => e
STDERR.write( "URI::InvalidURIError for #{@uri.path}." )
STDERR.write( "#{e}\n\n" )
rescue SystemCallError => e
STDERR.write( "Problem connecting to server (System call error) when downloading #{@uri.path}" )
STDERR.write( "#{e}\n\n" )
rescue OpenSSL::SSL::SSLError => e
STDERR.write( "OpenSSL::SSL::SSLError while downloading #{@uri.path}" )
STDERR.write( "#{e}\n\n" )
rescue Timeout::Error
STDERR.write( "Timeout error connecting to #{@uri.path}" )
STDERR.write( "#{e}\n\n" )
end
|