Skip to content

Commit

Permalink
[rubygems/rubygems] util/rubocop -A --only Lint/RescueException
Browse files Browse the repository at this point in the history
  • Loading branch information
hsbt committed Mar 23, 2023
1 parent 25ed2e7 commit 1a60012
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion lib/rubygems.rb
Expand Up @@ -1011,7 +1011,7 @@ def self.load_plugin_files(plugins) # :nodoc:

begin
load plugin
rescue ::Exception => e
rescue ScriptError, StandardError => e
details = "#{plugin.inspect}: #{e.message} (#{e.class})"
warn "Error loading RubyGems plugin #{details}"
end
Expand Down
2 changes: 1 addition & 1 deletion lib/rubygems/command_manager.rb
Expand Up @@ -237,7 +237,7 @@ def load_and_instantiate(command_name)
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}")
Expand Down
2 changes: 1 addition & 1 deletion lib/rubygems/core_ext/kernel_require.rb
Expand Up @@ -70,7 +70,7 @@ def require(path) # :doc:

begin
Kernel.send(:gem, spec.name, Gem::Requirement.default_prerelease)
rescue Exception
rescue StandardError
RUBYGEMS_ACTIVATION_MONITOR.exit
raise
end unless resolved_path
Expand Down
2 changes: 1 addition & 1 deletion lib/rubygems/indexer.rb
Expand Up @@ -200,7 +200,7 @@ def map_gems_to_specs(gems)
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")
Expand Down
2 changes: 1 addition & 1 deletion lib/rubygems/specification.rb
Expand Up @@ -1179,7 +1179,7 @@ def self.load(file)
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

Expand Down
@@ -1,3 +1,3 @@
# frozen_string_literal: true
TestGem::TEST_PLUGIN_EXCEPTION = :loaded
raise Exception.new("boom")
raise ScriptError.new("boom")
2 changes: 1 addition & 1 deletion test/rubygems/test_gem.rb
Expand Up @@ -1527,7 +1527,7 @@ def test_load_env_plugins
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
Expand Down
4 changes: 2 additions & 2 deletions test/rubygems/test_gem_ext_cargo_builder.rb
Expand Up @@ -41,7 +41,7 @@ def test_build_cdylib
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)
Expand All @@ -67,7 +67,7 @@ def test_rubygems_cfg_passed_to_rustc
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)
Expand Down
4 changes: 2 additions & 2 deletions test/rubygems/test_gem_remote_fetcher.rb
Expand Up @@ -1158,7 +1158,7 @@ def start_ssl_server(config = {})
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
Expand Down Expand Up @@ -1210,7 +1210,7 @@ def start_server(data)
end
th = Thread.new do
s.start
rescue Exception => ex
rescue StandardError => ex
abort "ERROR during server thread: #{ex.message}"
ensure
s.shutdown
Expand Down

0 comments on commit 1a60012

Please sign in to comment.