aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bundler
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2022-06-08 22:08:44 +0200
committergit <svn-admin@ruby-lang.org>2022-06-11 18:43:23 +0900
commit692fec4e727e5635ba03cdae4a08ce5f0d3c953b (patch)
tree058985715d4e697abd6c547d19d832089b9322fe /lib/bundler
parent572f3240fea870b8848a3e13eb8a8b9f2c45d800 (diff)
downloadruby-692fec4e727e5635ba03cdae4a08ce5f0d3c953b.tar.gz
[rubygems/rubygems] Simplify `Gem::Security::Exception` handling
These days all these errors are raised as `Gem::Security::Exception` so there's no need to do any matching on the exception message. https://github.com/rubygems/rubygems/commit/bd3403da57
Diffstat (limited to 'lib/bundler')
-rw-r--r--lib/bundler/rubygems_integration.rb14
1 files changed, 4 insertions, 10 deletions
diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb
index 637307389d..7e1f5ee451 100644
--- a/lib/bundler/rubygems_integration.rb
+++ b/lib/bundler/rubygems_integration.rb
@@ -206,16 +206,10 @@ module Bundler
def spec_from_gem(path, policy = nil)
require "psych"
gem_from_path(path, security_policies[policy]).spec
- rescue Exception, Gem::Exception, Gem::Security::Exception => e # rubocop:disable Lint/RescueException
- if e.is_a?(Gem::Security::Exception) ||
- e.message =~ /unknown trust policy|unsigned gem/i ||
- e.message =~ /couldn't verify (meta)?data signature/i
- raise SecurityError,
- "The gem #{File.basename(path, ".gem")} can't be installed because " \
- "the security policy didn't allow it, with the message: #{e.message}"
- else
- raise e
- end
+ rescue Gem::Security::Exception => e
+ raise SecurityError,
+ "The gem #{File.basename(path, ".gem")} can't be installed because " \
+ "the security policy didn't allow it, with the message: #{e.message}"
end
def build_gem(gem_dir, spec)