mirror of
https://github.com/lostisland/faraday.git
synced 2025-10-06 00:03:36 -04:00
raise proper exception for Excon timeout
This commit is contained in:
parent
a69357d8cf
commit
d8aba7a99a
2
Gemfile
2
Gemfile
@ -7,7 +7,7 @@ end
|
||||
group :test do
|
||||
gem 'em-http-request', '~> 1.0', :require => 'em-http'
|
||||
gem 'em-synchrony', '~> 1.0', :require => ['em-synchrony', 'em-synchrony/em-http'], :platforms => :ruby_19
|
||||
gem 'excon', '~> 0.9', '> 0.9.6'
|
||||
gem 'excon', '~> 0.14'
|
||||
gem 'httpclient', '~> 2.2'
|
||||
gem 'net-http-persistent', '~> 2.5', :require => false
|
||||
gem 'leftright', '~> 0.9', :require => false
|
||||
|
@ -40,10 +40,14 @@ module Faraday
|
||||
save_response(env, resp.status.to_i, resp.body, resp.headers)
|
||||
|
||||
@app.call env
|
||||
rescue ::Excon::Errors::SocketError
|
||||
raise Error::ConnectionFailed, $!
|
||||
rescue ::Excon::Errors::SocketError => err
|
||||
if err.message =~ /\btimeout\b/
|
||||
raise Error::TimeoutError, err
|
||||
else
|
||||
raise Error::ConnectionFailed, err
|
||||
end
|
||||
rescue ::Excon::Errors::Timeout => err
|
||||
raise Faraday::Error::TimeoutError, err
|
||||
raise Error::TimeoutError, err
|
||||
end
|
||||
|
||||
# TODO: support streaming requests
|
||||
|
Loading…
x
Reference in New Issue
Block a user