Horacio Sanson wrote: > 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 Try to rescue SystemCallError (all off the Errno should fall in this category) or Exception. > thanks > Horacio E -- Posted via http://www.ruby-forum.com/.