H
Horacio Sanson
This is a little method I use to download webpages. It works ok until I
started receiving some Errno::ETIMEDOUT errors that cause my script to fail.
I tried rescuing this error using recue Timeout::Error but it doesn't work.
Any ideas how can I catch this error to avoid the script to fail and just
ignore the error??
def connect
# Do we have a url to process do we?? if not simply return
if not @uri
return nil
end
begin
h = Net::HTTP.new(@uri.host, @uri.port)
h.use_ssl = true if @uri.scheme == "https"
@resp = h.get(@uri.request_uri, nil )
rescue SocketError
@resp = Net::HTTPNotFound.new(1.1, 404, "Not Found")
end
return @resp
end
thanks
Horacio
started receiving some Errno::ETIMEDOUT errors that cause my script to fail.
I tried rescuing this error using recue Timeout::Error but it doesn't work.
Any ideas how can I catch this error to avoid the script to fail and just
ignore the error??
def connect
# Do we have a url to process do we?? if not simply return
if not @uri
return nil
end
begin
h = Net::HTTP.new(@uri.host, @uri.port)
h.use_ssl = true if @uri.scheme == "https"
@resp = h.get(@uri.request_uri, nil )
rescue SocketError
@resp = Net::HTTPNotFound.new(1.1, 404, "Not Found")
end
return @resp
end
thanks
Horacio