How to tell a connect timeout error from a read timeout error in Ruby's Net::HTTP
- by Ben Marini
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?