Issue #18068 has been reported by daniel_niknam (Daniel Niknam).

----------------------------------------
Misc #18068: Silence LoadError only if it is for rubygems itself
https://bugs.ruby-lang.org/issues/18068

* Author: daniel_niknam (Daniel Niknam)
* Status: Open
* Priority: Normal
* Assignee: hsbt (Hiroshi SHIBATA)
----------------------------------------
**Background**


The "Optionally load did_you_mean and RubyGems" PR (https://github.com/ruby/ruby/pull/2764) attempted to prevent raising `LoadError` when requiring `rubygems` because it might not be available optionally when Ruby is delivered via packaging systems and instead prints a warning message.

**Context**

I was working on a feature in RubyGems to better communicate to users that something went wrong when loading `rubygems/defaults/operating_system` and after writing a test, I saw that any `LoadError` exception raised by the rubygems will be captured and a warning will be printed instead (https://github.com/rubygems/rubygems/pull/4824). Although "Optionally load did_you_mean and RubyGems" PR intention was to prevent failure when `rubygems` are not available, it's capturing every `LoadError` that might happen inside the `rubygems` at runtime.

**Change**

I have created a PR: https://github.com/ruby/ruby/pull/4719
Prevent raising the LoadError exception only if it's related directly to loading `rubygems`

**Affected ruby versions**
3.x




-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>