How to tell a connect timeout error from a read timeout error in Ruby's Net::HTTP
Posted
by Ben Marini
on Stack Overflow
See other posts from Stack Overflow
or by Ben Marini
Published on 2010-04-12T21:22:08Z
Indexed on
2010/04/12
22:13 UTC
Read the original article
Hit count: 568
ruby
My question is related to http://stackoverflow.com/questions/2370140/how-to-rescue-timeout-issues-ruby-rails.
Here's the common way to rescue from a timeout:
def action
# Post using Net::HTTP
rescue Timeout::Error => e
# Do something
end
I'd like to determine if the exception was raised while trying to connect to the host, or if it was raised while trying to read from the host. Is this possible?
© Stack Overflow or respective owner