Skip to content

Commit

Permalink
Added additional error to the list of retryable networking errors.
Browse files Browse the repository at this point in the history
Fixes #1202
  • Loading branch information
trevorrowe committed Jun 20, 2016
1 parent c4bc22b commit e346166
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
7 changes: 7 additions & 0 deletions aws-sdk-core/lib/seahorse/client/net_http/handler.rb
@@ -1,3 +1,5 @@
require 'openssl'

module Seahorse
module Client
module NetHttp
Expand All @@ -22,6 +24,11 @@ def initialize(bytes_expected, bytes_received)
Errno::EHOSTUNREACH, Errno::ECONNREFUSED
]

# does not exist in Ruby 1.9.3
if OpenSSL::SSL.const_defined?(:SSLErrorWaitReadable)
NETWORK_ERRORS << OpenSSL::SSL::SSLErrorWaitReadable
end

# @api private
DNS_ERROR_MESSAGE = 'getaddrinfo: nodename nor servname provided, or not known'

Expand Down
12 changes: 12 additions & 0 deletions aws-sdk-core/spec/seahorse/client/net_http/handler_spec.rb
Expand Up @@ -2,6 +2,7 @@
require 'ostruct'
require 'stringio'
require 'uri'
require 'openssl'

module Seahorse
module Client
Expand Down Expand Up @@ -256,6 +257,17 @@ def endpoint
expect(resp.error).to be_a(Seahorse::Client::NetworkingError)
end

if OpenSSL::SSL.const_defined?(:SSLErrorWaitReadable)
it 'wraps OpenSSL::SSL::SSLErrorWaitReadable w/NetworkingError' do
stub_request(:any, endpoint).to_raise(
OpenSSL::SSL::SSLErrorWaitReadable)
resp = make_request
expect(resp.error).to be_a(Seahorse::Client::NetworkingError)
expect(resp.error.original_error).to(
be_kind_of(OpenSSL::SSL::SSLErrorWaitReadable))
end
end

end

describe 'DNS errors' do
Expand Down

0 comments on commit e346166

Please sign in to comment.