40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
# File 'lib/faraday/adapter/em_synchrony.rb', line 40
def call(env)
super
request = create_request(env)
http_method = env[:method].to_s.downcase.to_sym
if env[:parallel_manager]
execute_parallel_request(env, request, http_method)
else
execute_single_request(env, request, http_method)
end
@app.call env
rescue Errno::ECONNREFUSED
raise Faraday::ConnectionFailed, $ERROR_INFO
rescue EventMachine::Connectify::CONNECTError => e
if e.message.include?('Proxy Authentication Required')
raise Faraday::ConnectionFailed,
%(407 "Proxy Authentication Required")
end
raise Faraday::ConnectionFailed, e
rescue Errno::ETIMEDOUT => e
raise Faraday::TimeoutError, e
rescue RuntimeError => e
if e.message == 'connection closed by server'
raise Faraday::ConnectionFailed, e
end
raise Faraday::TimeoutError, e if e.message.include?('timeout error')
raise
rescue StandardError => e
if defined?(OpenSSL) && e.is_a?(OpenSSL::SSL::SSLError)
raise Faraday::SSLError, e
end
raise
end
|