I am playing around with the Net::HTTP
and I want my crawler ( agent, if you like)
to catch the Net::HTTPRequestTimeOut

Here is what I do...

agent = Net::HTTP.new('www.cnn.com', 80)

# I have tried to add this but it doesn't work either#
agent.open_timeout = 5

begin
  resp, data = agent.get(url, nil)

  rescue Net::HTTPRequestTimeOut => details
     return NIL

end

I got error
/ruby/lib/ruby/1.6/net/protocol.rb:73:in `get': class or module
required for rescue clause (TypeError)

So what is the right way to do it?
I add in other rescue and it seems fine to me except when I add
Net::HTTPRequestTimeOut
Net::HTTPGatewayTimeOut
Errno::ETIMEOUT

Any idea?