diff --git a/lib/redis_client/ruby_connection.rb b/lib/redis_client/ruby_connection.rb index d1190ac..edec5cb 100644 --- a/lib/redis_client/ruby_connection.rb +++ b/lib/redis_client/ruby_connection.rb @@ -116,7 +116,12 @@ def connect UNIXSocket.new(@config.path) else sock = if SUPPORTS_RESOLV_TIMEOUT - Socket.tcp(@config.host, @config.port, connect_timeout: @connect_timeout, resolv_timeout: @connect_timeout) + begin + Socket.tcp(@config.host, @config.port, connect_timeout: @connect_timeout, resolv_timeout: @connect_timeout) + rescue Errno::ETIMEDOUT => timeout_error + timeout_error.message << ": #{@connect_timeout}s" + raise + end else Socket.tcp(@config.host, @config.port, connect_timeout: @connect_timeout) end