Judson Lester wrote: > Your problem is that you're catching the exception outside of the loop. Should that matter? The extension is still happening after the begin, so the rescue should catch it. > Try > something like: > > > list = IO.foreach(url_file) do |line| > begin > agent.get(line) > rescue WWW::Mechanize::ResponseCodeError > puts "Page not found" > end > end (The inner begin and end are not actually needed here, I think.) Best, -- Marnen Laibow-Koser http://www.marnen.org marnen / marnen.org -- Posted via http://www.ruby-forum.com/.