lib/httpx/io/tcp.rb in httpx-0.22.0 vs lib/httpx/io/tcp.rb in httpx-0.22.1
- old
+ new
@@ -72,11 +72,16 @@
@io = build_socket
end
try_connect
rescue Errno::ECONNREFUSED,
Errno::EADDRNOTAVAIL,
- Errno::EHOSTUNREACH => e
- raise e if @ip_index <= 0
+ Errno::EHOSTUNREACH,
+ SocketError => e
+ if @ip_index <= 0
+ error = ConnectionError.new(e.message)
+ error.set_backtrace(e.backtrace)
+ raise error
+ end
log { "failed connecting to #{@ip} (#{e.message}), trying next..." }
@ip_index -= 1
@io = build_socket
retry