Skip to content
Open
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
1 change: 1 addition & 0 deletions lib/active_utils/network_connection_retries.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ 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",
Errno::EHOSTUNREACH => "The connection to the remote server could not be established",
OpenSSL::SSL::SSLError => "The SSL connection to the remote server could not be established"
}

Expand Down
14 changes: 9 additions & 5 deletions test/unit/network_connection_retries_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,17 @@ def test_timeout_errors_raise_correctly
end
end

def test_socket_error_raises_correctly
raised = assert_raises(ActiveUtils::ConnectionError) do
retry_exceptions do
raise SocketError
def test_connection_errors_raise_correctly
exceptions = [SocketError, Errno::EHOSTUNREACH]

exceptions.each do |exception|
raised = assert_raises(ActiveUtils::ConnectionError) do
retry_exceptions do
raise exception
end
end
assert_equal "The connection to the remote server could not be established", raised.message
end
assert_equal "The connection to the remote server could not be established", raised.message
end

def test_ssl_errors_raise_correctly
Expand Down