[前][次][番号順一覧][スレッド一覧]

ruby-changes:67450

From: Daniel <ko1@a...>
Date: Tue, 31 Aug 2021 19:07:35 +0900 (JST)
Subject: [ruby-changes:67450] 717ad64f41 (master): [rubygems/rubygems] Replace StandardError with Exception

https://git.ruby-lang.org/ruby.git/commit/?id=717ad64f41

From 717ad64f4198066ae1eedfb166e38e8f00f44705 Mon Sep 17 00:00:00 2001
From: Daniel Niknam <mhmd.niknam@g...>
Date: Sun, 8 Aug 2021 19:45:14 +1000
Subject: [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
---
 lib/rubygems.rb                | 2 +-
 test/rubygems/test_rubygems.rb | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/rubygems.rb b/lib/rubygems.rb
index 9b563f2..9e8776b 100644
--- a/lib/rubygems.rb
+++ b/lib/rubygems.rb
@@ -1332,7 +1332,7 @@ begin https://github.com/ruby/ruby/blob/trunk/lib/rubygems.rb#L1332
   require 'rubygems/defaults/operating_system'
 rescue LoadError
   # Ignored
-rescue Exception => e
+rescue StandardError => e
   msg = "#{e.message}\n" \
     "Loading the rubygems/defaults/operating_system.rb file caused an error. " \
     "This file is owned by your OS, not by rubygems upstream. " \
diff --git a/test/rubygems/test_rubygems.rb b/test/rubygems/test_rubygems.rb
index f94481d..493b9fd 100644
--- a/test/rubygems/test_rubygems.rb
+++ b/test/rubygems/test_rubygems.rb
@@ -10,12 +10,12 @@ class GemTest < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_rubygems.rb#L10
     pend "does not apply to truffleruby" if RUBY_ENGINE == 'truffleruby'
 
     path = util_install_operating_system_rb <<-RUBY
-      intentional synt'ax error
+      intentionally_not_implemented_method
     RUBY
 
     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_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. " \
     "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 " \
-- 
cgit v1.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]