aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rubygems.rb
diff options
context:
space:
mode:
authorDaniel Niknam <mhmd.niknam@gmail.com>2021-08-08 16:23:31 +1000
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2021-08-31 19:06:14 +0900
commitaafc615b4aff8b05efa14d30f0eb7c6adc5fde85 (patch)
tree3c3b74b3ff3391f4d97a0ac5fa212b2ef41200b3 /lib/rubygems.rb
parent9fa5c4cd0721f720282dfc9efe5657b136c7e99b (diff)
downloadruby-aafc615b4aff8b05efa14d30f0eb7c6adc5fde85.tar.gz
[rubygems/rubygems] Enhance error handling when loading the rubygems/defaults/operating_system file
When loading `rubygems/defaults/operating_system` - we want to keep it silent if the raised exception is a LoadError - we want to print a message in other cases and ask users to report the issue to their OS support. Ruby 3 comes with special error handling for loading `rubygems` and it will show a warning when LoadError exception raised for requiring 'rubygem'. Because of that, we decided to leave the LoadError scenario as it is. Reference: https://github.com/ruby/ruby/blob/d1998d8767affe58be0bd09ec536dae9198a7fbd/gem_prelude.rb#L1-L5 https://github.com/rubygems/rubygems/commit/0a97e12fe1
Diffstat (limited to 'lib/rubygems.rb')
-rw-r--r--lib/rubygems.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/rubygems.rb b/lib/rubygems.rb
index 17881e2e0e..e750277dd3 100644
--- a/lib/rubygems.rb
+++ b/lib/rubygems.rb
@@ -1331,6 +1331,9 @@ begin
require 'rubygems/defaults/operating_system'
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."
end
begin