aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2023-03-22 12:25:40 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2023-03-23 17:18:49 +0900
commit1a600126126e2f531377646e929280c756e69929 (patch)
treeb5880e41993fbabf1edb9c11348ea0dc5e6378c7
parent25ed2e7415ded52837e3ade1b43efe1def9493d2 (diff)
downloadruby-1a600126126e2f531377646e929280c756e69929.tar.gz
[rubygems/rubygems] util/rubocop -A --only Lint/RescueException
https://github.com/rubygems/rubygems/commit/e8a5db50af
-rw-r--r--lib/rubygems.rb2
-rw-r--r--lib/rubygems/command_manager.rb2
-rw-r--r--lib/rubygems/core_ext/kernel_require.rb2
-rw-r--r--lib/rubygems/indexer.rb2
-rw-r--r--lib/rubygems/specification.rb2
-rw-r--r--test/rubygems/plugin/scripterror/rubygems_plugin.rb (renamed from test/rubygems/plugin/exception/rubygems_plugin.rb)2
-rw-r--r--test/rubygems/test_gem.rb2
-rw-r--r--test/rubygems/test_gem_ext_cargo_builder.rb4
-rw-r--r--test/rubygems/test_gem_remote_fetcher.rb4
9 files changed, 11 insertions, 11 deletions
diff --git a/lib/rubygems.rb b/lib/rubygems.rb
index 00749bc0cf..9f63c027c9 100644
--- a/lib/rubygems.rb
+++ b/lib/rubygems.rb
@@ -1011,7 +1011,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
begin
load plugin
- rescue ::Exception => e
+ rescue ScriptError, StandardError => e
details = "#{plugin.inspect}: #{e.message} (#{e.class})"
warn "Error loading RubyGems plugin #{details}"
end
diff --git a/lib/rubygems/command_manager.rb b/lib/rubygems/command_manager.rb
index 5ceaf1c63c..8af31824ee 100644
--- a/lib/rubygems/command_manager.rb
+++ b/lib/rubygems/command_manager.rb
@@ -237,7 +237,7 @@ class Gem::CommandManager
load_error = e
end
Gem::Commands.const_get(const_name).new
- rescue Exception => e
+ rescue StandardError => e
e = load_error if load_error
alert_error clean_text("Loading command: #{command_name} (#{e.class})\n\t#{e}")
diff --git a/lib/rubygems/core_ext/kernel_require.rb b/lib/rubygems/core_ext/kernel_require.rb
index 5f768f3b23..69edcd23af 100644
--- a/lib/rubygems/core_ext/kernel_require.rb
+++ b/lib/rubygems/core_ext/kernel_require.rb
@@ -70,7 +70,7 @@ module Kernel
begin
Kernel.send(:gem, spec.name, Gem::Requirement.default_prerelease)
- rescue Exception
+ rescue StandardError
RUBYGEMS_ACTIVATION_MONITOR.exit
raise
end unless resolved_path
diff --git a/lib/rubygems/indexer.rb b/lib/rubygems/indexer.rb
index d0061ff82e..cb8abc286d 100644
--- a/lib/rubygems/indexer.rb
+++ b/lib/rubygems/indexer.rb
@@ -200,7 +200,7 @@ class Gem::Indexer
rescue SignalException
alert_error "Received signal, exiting"
raise
- rescue Exception => e
+ rescue StandardError => e
msg = ["Unable to process #{gemfile}",
"#{e.message} (#{e.class})",
"\t#{e.backtrace.join "\n\t"}"].join("\n")
diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb
index 1cb6873db0..f003dad777 100644
--- a/lib/rubygems/specification.rb
+++ b/lib/rubygems/specification.rb
@@ -1179,7 +1179,7 @@ class Gem::Specification < Gem::BasicSpecification
warn "[#{file}] isn't a Gem::Specification (#{_spec.class} instead)."
rescue SignalException, SystemExit
raise
- rescue SyntaxError, Exception => e
+ rescue SyntaxError, StandardError => e
warn "Invalid gemspec in [#{file}]: #{e}"
end
diff --git a/test/rubygems/plugin/exception/rubygems_plugin.rb b/test/rubygems/plugin/scripterror/rubygems_plugin.rb
index f54e689d87..7479906ff5 100644
--- a/test/rubygems/plugin/exception/rubygems_plugin.rb
+++ b/test/rubygems/plugin/scripterror/rubygems_plugin.rb
@@ -1,3 +1,3 @@
# frozen_string_literal: true
TestGem::TEST_PLUGIN_EXCEPTION = :loaded
-raise Exception.new("boom")
+raise ScriptError.new("boom")
diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb
index da0b0a4c29..bfa896b2ee 100644
--- a/test/rubygems/test_gem.rb
+++ b/test/rubygems/test_gem.rb
@@ -1527,7 +1527,7 @@ class TestGem < Gem::TestCase
util_remove_interrupt_command
# Should attempt to cause an Exception
- with_plugin("exception") { Gem.load_env_plugins }
+ with_plugin("scripterror") { Gem.load_env_plugins }
begin
assert_equal :loaded, TEST_PLUGIN_EXCEPTION
rescue StandardError
diff --git a/test/rubygems/test_gem_ext_cargo_builder.rb b/test/rubygems/test_gem_ext_cargo_builder.rb
index de85a60711..614ae9eeaf 100644
--- a/test/rubygems/test_gem_ext_cargo_builder.rb
+++ b/test/rubygems/test_gem_ext_cargo_builder.rb
@@ -41,7 +41,7 @@ class TestGemExtCargoBuilder < Gem::TestCase
assert_match(/Finished/, output)
assert_match(/release/, output)
assert_ffi_handle bundle, "Init_rust_ruby_example"
- rescue Exception => e
+ rescue StandardError => e
pp output if output
raise(e)
@@ -67,7 +67,7 @@ class TestGemExtCargoBuilder < Gem::TestCase
assert_ffi_handle bundle, "hello_from_rubygems"
assert_ffi_handle bundle, "hello_from_rubygems_version"
refute_ffi_handle bundle, "should_never_exist"
- rescue Exception => e
+ rescue StandardError => e
pp output if output
raise(e)
diff --git a/test/rubygems/test_gem_remote_fetcher.rb b/test/rubygems/test_gem_remote_fetcher.rb
index 088acad841..a9937afecc 100644
--- a/test/rubygems/test_gem_remote_fetcher.rb
+++ b/test/rubygems/test_gem_remote_fetcher.rb
@@ -1158,7 +1158,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
server.ssl_context.tmp_dh_callback = proc { TEST_KEY_DH2048 }
t = Thread.new do
server.start
- rescue Exception => ex
+ rescue StandardError => ex
puts "ERROR during server thread: #{ex.message}"
raise
ensure
@@ -1210,7 +1210,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
end
th = Thread.new do
s.start
- rescue Exception => ex
+ rescue StandardError => ex
abort "ERROR during server thread: #{ex.message}"
ensure
s.shutdown