[rubygems/rubygems] Replace StandardError with Exception
We think it's unlikely that `rubygems/defaults/operating_system` could be shipped with a SyntaxError so StandardError could be better choice to prevent "false positives" errors. https://github.com/rubygems/rubygems/commit/1f73e784dd
This commit is contained in:
parent
34e073c0ca
commit
717ad64f41
Notes:
git
2021-08-31 19:07:08 +09:00
@ -1332,7 +1332,7 @@ begin
|
|||||||
require 'rubygems/defaults/operating_system'
|
require 'rubygems/defaults/operating_system'
|
||||||
rescue LoadError
|
rescue LoadError
|
||||||
# Ignored
|
# Ignored
|
||||||
rescue Exception => e
|
rescue StandardError => e
|
||||||
msg = "#{e.message}\n" \
|
msg = "#{e.message}\n" \
|
||||||
"Loading the rubygems/defaults/operating_system.rb file caused an error. " \
|
"Loading the rubygems/defaults/operating_system.rb file caused an error. " \
|
||||||
"This file is owned by your OS, not by rubygems upstream. " \
|
"This file is owned by your OS, not by rubygems upstream. " \
|
||||||
|
@ -10,12 +10,12 @@ class GemTest < Gem::TestCase
|
|||||||
pend "does not apply to truffleruby" if RUBY_ENGINE == 'truffleruby'
|
pend "does not apply to truffleruby" if RUBY_ENGINE == 'truffleruby'
|
||||||
|
|
||||||
path = util_install_operating_system_rb <<-RUBY
|
path = util_install_operating_system_rb <<-RUBY
|
||||||
intentional synt'ax error
|
intentionally_not_implemented_method
|
||||||
RUBY
|
RUBY
|
||||||
|
|
||||||
output = Gem::Util.popen(*ruby_with_rubygems_and_fake_operating_system_in_load_path(path), '-e', "'require \"rubygems\"'", {:err => [:child, :out]}).strip
|
output = Gem::Util.popen(*ruby_with_rubygems_and_fake_operating_system_in_load_path(path), '-e', "'require \"rubygems\"'", {:err => [:child, :out]}).strip
|
||||||
assert !$?.success?
|
assert !$?.success?
|
||||||
assert_includes output, "unterminated string meets end of file (SyntaxError)"
|
assert_includes output, "undefined local variable or method `intentionally_not_implemented_method'"
|
||||||
assert_includes output, "Loading the rubygems/defaults/operating_system.rb file caused an error. " \
|
assert_includes output, "Loading the rubygems/defaults/operating_system.rb file caused an error. " \
|
||||||
"This file is owned by your OS, not by rubygems upstream. " \
|
"This file is owned by your OS, not by rubygems upstream. " \
|
||||||
"Please find out which OS package this file belongs to and follow the guidelines from your OS to report " \
|
"Please find out which OS package this file belongs to and follow the guidelines from your OS to report " \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user