Permalink
Browse files

Update to latest common + update_common rake task

  • Loading branch information...
tobi committed Jun 27, 2010
1 parent 745f950 commit 71868a003eea449ccd33b593e79a3cc82ea9cf07
Showing with 13 additions and 0 deletions.
  1. +7 −0 Rakefile
  2. +1 −0 lib/active_merchant/common.rb
  3. +2 −0 lib/active_merchant/common/connection.rb
  4. +3 −0 lib/active_merchant/common/error.rb
View
@@ -51,3 +51,10 @@ begin
rescue LoadError
puts "Jeweler not available. Install it with: gem install jeweler"
end
+
+task :update_common do
+ STDERR.puts "Updating common include from ../active_merchant. Please make sure this is up-to-date"
+ system("diff -u lib/active_merchant/common.rb ../active_merchant/lib/active_merchant/common.rb | patch -p0")
+ system("diff -ur lib/active_merchant/common ../active_merchant/lib/active_merchant/common | patch -p0")
+ STDERR.puts "done.."
+end
@@ -5,6 +5,7 @@ module ActiveMerchant
autoload :ConnectionError, 'active_merchant/common/error'
autoload :RetriableConnectionError, 'active_merchant/common/error'
autoload :ResponseError, 'active_merchant/common/error'
+ autoload :ClientCertificateError, 'active_merchant/common/error'
autoload :PostData, 'active_merchant/common/post_data'
autoload :PostsData, 'active_merchant/common/posts_data'
autoload :RequiresParameters, 'active_merchant/common/requires_parameters'
@@ -80,6 +80,8 @@ def request(method, body, headers = {})
raise ConnectionError, "The remote server reset the connection"
rescue Errno::ECONNREFUSED => e
raise RetriableConnectionError, "The remote server refused the connection"
+ rescue OpenSSL::X509::CertificateError => e
+ raise ClientCertificateError, "The remote server did not accept the provided SSL certificate"
rescue Timeout::Error, Errno::ETIMEDOUT => e
raise ConnectionError, "The connection to the remote server timed out"
end
@@ -20,4 +20,7 @@ def to_s
"Failed with #{response.code} #{response.message if response.respond_to?(:message)}"
end
end
+
+ class ClientCertificateError < ActiveMerchantError # :nodoc
+ end
end

0 comments on commit 71868a0

Please sign in to comment.