[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
This commit is contained in:
David Rodríguez 2022-06-08 22:08:44 +02:00 коммит произвёл git
Родитель 572f3240fe
Коммит 692fec4e72
1 изменённых файлов: 4 добавлений и 10 удалений

Просмотреть файл

@ -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
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}"
else
raise e
end
end
def build_gem(gem_dir, spec)