diff options
author | Homu <homu@barosl.com> | 2015-12-27 18:42:52 +0900 |
---|---|---|
committer | Homu <homu@barosl.com> | 2015-12-27 18:42:52 +0900 |
commit | f61747e83ecea99a8c73c9ca104edddfbac1d89f (patch) | |
tree | b936292381bab382c6f166db9c436fc8238f5c21 | |
parent | e2b14375c3ed2ef679fed1ca894dd346cbcefcf1 (diff) | |
parent | 397710eaa10f84690e3614b8c8698f2f9cfd28c9 (diff) | |
download | bundler-f61747e83ecea99a8c73c9ca104edddfbac1d89f.tar.gz |
Auto merge of #4188 - RochesterinNYC:catch-no-use-ssl-method-error, r=indirect
Catch NoMethodError for `use_ssl=` and raise appropriate FriendlyErrors warning
Addresses #4054.
- `NoMethodError` for `use_ssl=` in the downloader should now throw a `LoadError` with `cannot load such file -- openssl` as the message which will be caught and logged by the `FriendlyErrors` module as an OpenSSL Ruby error.
-rw-r--r-- | lib/bundler/fetcher/downloader.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/bundler/fetcher/downloader.rb b/lib/bundler/fetcher/downloader.rb index 8efeb14461..3e05b77d5e 100644 --- a/lib/bundler/fetcher/downloader.rb +++ b/lib/bundler/fetcher/downloader.rb @@ -43,6 +43,12 @@ module Bundler req.basic_auth(user, password) end connection.request(uri, req) + rescue NoMethodError => e + if ["undefined method", "use_ssl="].all? {|snippet| e.message.include? snippet } + raise LoadError.new("cannot load such file -- openssl") + else + raise e + end rescue OpenSSL::SSL::SSLError raise CertificateFailureError.new(uri) rescue *HTTP_ERRORS => e |