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

ruby-changes:67451

From: Daniel <ko1@a...>
Date: Tue, 31 Aug 2021 19:07:36 +0900 (JST)
Subject: [ruby-changes:67451] 34e073c0ca (master): [rubygems/rubygems] Reword the message

https://git.ruby-lang.org/ruby.git/commit/?id=34e073c0ca

From 34e073c0ca4a7bb0c7e07df883babeaafb03b438 Mon Sep 17 00:00:00 2001
From: Daniel Niknam <mhmd.niknam@g...>
Date: Sun, 8 Aug 2021 19:40:05 +1000
Subject: [rubygems/rubygems] Reword the message

For errors that could happened while loading `rubygems/defaults/operating_system`

https://github.com/rubygems/rubygems/commit/6e1e2141f8
---
 lib/rubygems.rb                | 7 ++++++-
 test/rubygems/test_rubygems.rb | 6 +++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/lib/rubygems.rb b/lib/rubygems.rb
index e750277..9b563f2 100644
--- a/lib/rubygems.rb
+++ b/lib/rubygems.rb
@@ -1333,7 +1333,12 @@ begin https://github.com/ruby/ruby/blob/trunk/lib/rubygems.rb#L1333
 rescue LoadError
   # Ignored
 rescue Exception => e
-  raise e.class, "#{e.message}\nThis is not expected so please report this issue to your OS support and ask for help."
+  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. " \
+    "Please find out which OS package this file belongs to and follow the guidelines from your OS to report " \
+    "the problem and ask for help."
+  raise e.class, msg
 end
 
 begin
diff --git a/test/rubygems/test_rubygems.rb b/test/rubygems/test_rubygems.rb
index 9aa6c20..f94481d 100644
--- a/test/rubygems/test_rubygems.rb
+++ b/test/rubygems/test_rubygems.rb
@@ -15,7 +15,11 @@ class GemTest < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_rubygems.rb#L15
 
     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, "This is not expected so please report this issue to your OS support and ask for help"
+    assert_includes output, "unterminated string meets end of file (SyntaxError)"
+    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 " \
+    "the problem and ask for help."
   end
 
   private
-- 
cgit v1.1


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

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