Skip to content

Commit b70aecb

Browse files
committed
Add Errno::EHOSTUNREACH to possible CannotConnectError failures
This happens when the server has disappeared (power failure, kernel causing a reboot, etc)
1 parent e221f90 commit b70aecb

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/redis/client.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,8 @@ def establish_connection
307307
raise CannotConnectError, "Timed out connecting to Redis on #{location}"
308308
rescue Errno::ECONNREFUSED
309309
raise CannotConnectError, "Error connecting to Redis on #{location} (ECONNREFUSED)"
310+
rescue Errno::EHOSTUNREACH
311+
raise CannotConnectError, "Error connecting to Redis on #{location} (EHOSTUNREACH)"
310312
end
311313

312314
def ensure_connected

0 commit comments

Comments
 (0)