Skip to content

Commit

Permalink
Merge pull request #715 from cds2-stripe/cds/augment-proxy-connection…
Browse files Browse the repository at this point in the history
…-error

embed response from proxy in ProxyConnectionError
  • Loading branch information
geemus committed Mar 17, 2020
2 parents ea04f69 + 36744bd commit 7956635
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion lib/excon/error.rb
Expand Up @@ -50,7 +50,17 @@ class InvalidHeaderKey < Error; end
class InvalidHeaderValue < Error; end
class Timeout < Error; end
class ResponseParse < Error; end
class ProxyConnectionError < Error; end

class ProxyConnectionError < Error
attr_reader :request, :response

def initialize(msg, request = nil, response = nil)
super(msg)
@request = request
@response = response
end
end

class ProxyParse < Error; end
class TooManyRedirects < Error; end

Expand Down
2 changes: 1 addition & 1 deletion lib/excon/ssl_socket.rb
Expand Up @@ -109,7 +109,7 @@ def initialize(data = {})
# eat the proxy's connection response
response = Excon::Response.parse(self, :expects => 200, :method => 'CONNECT')
if response[:response][:status] != 200
raise(Excon::Errors::ProxyConnectionError.new("proxy connection is not exstablished"))
raise(Excon::Errors::ProxyConnectionError.new("proxy connection could not be established", request, response))
end
end

Expand Down

0 comments on commit 7956635

Please sign in to comment.