Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/active_utils/network_connection_retries.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ module NetworkConnectionRetries
Timeout::Error => "The connection to the remote server timed out",
Errno::ETIMEDOUT => "The connection to the remote server timed out",
SocketError => "The connection to the remote server could not be established",
OpenSSL::SSL::SSLError => "The SSL connection to the remote server could not be established"
OpenSSL::SSL::SSLError => "The SSL connection to the remote server could not be established",
Errno::EHOSTUNREACH => "The remote server could not be reached",
Errno::EADDRNOTAVAIL => "The remote server address is not available"
}

DEFAULT_RETRY_ERRORS = {
Expand Down
18 changes: 18 additions & 0 deletions test/unit/network_connection_retries_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,24 @@ def test_econnreset_raises_correctly
assert_equal "The remote server reset the connection", raised.message
end

def test_ehostunreach_raises_correctly
raised = assert_raises(ActiveUtils::ConnectionError) do
retry_exceptions do
raise Errno::EHOSTUNREACH
end
end
assert_equal "The remote server could not be reached", raised.message
end

def test_eaddrnotavail_raises_correctly
raised = assert_raises(ActiveUtils::ConnectionError) do
retry_exceptions do
raise Errno::EADDRNOTAVAIL
end
end
assert_equal "The remote server address is not available", raised.message
end

def test_timeout_errors_raise_correctly
exceptions = [Timeout::Error, Errno::ETIMEDOUT]
if RUBY_VERSION >= '2.0.0'
Expand Down