diff --git a/lib/excon/error.rb b/lib/excon/error.rb index 99374911..58945a17 100644 --- a/lib/excon/error.rb +++ b/lib/excon/error.rb @@ -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 diff --git a/lib/excon/ssl_socket.rb b/lib/excon/ssl_socket.rb index 8ec32401..f07e6df4 100644 --- a/lib/excon/ssl_socket.rb +++ b/lib/excon/ssl_socket.rb @@ -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