Skip to content

Commit 05056c6

Browse files
committed
Handles ENETUNREACH syscall errors (3.6.0)
1 parent 758ff8b commit 05056c6

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

lib/active_utils/network_connection_retries.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ module NetworkConnectionRetries
99
SocketError => "The connection to the remote server could not be established",
1010
OpenSSL::SSL::SSLError => "The SSL connection to the remote server could not be established",
1111
Errno::EHOSTUNREACH => "The remote server could not be reached",
12-
Errno::EADDRNOTAVAIL => "The remote server address is not available"
12+
Errno::EADDRNOTAVAIL => "The remote server address is not available",
13+
Errno::ENETUNREACH => "The destination network is unreachable"
1314
}
1415

1516
DEFAULT_RETRY_ERRORS = {

test/unit/network_connection_retries_test.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,15 @@ def test_eaddrnotavail_raises_correctly
5050
assert_equal "The remote server address is not available", raised.message
5151
end
5252

53+
def test_enetunreach_raises_correctly
54+
raised = assert_raises(ActiveUtils::ConnectionError) do
55+
retry_exceptions do
56+
raise Errno::ENETUNREACH
57+
end
58+
end
59+
assert_equal "The destination network is unreachable", raised.message
60+
end
61+
5362
def test_timeout_errors_raise_correctly
5463
exceptions = [Timeout::Error, Errno::ETIMEDOUT]
5564
if RUBY_VERSION >= '2.0.0'

0 commit comments

Comments
 (0)