Project

General

Profile

Actions

Misc #18068

open

Silence LoadError only if it is for rubygems itself

Added by daniel_niknam (Daniel Niknam) 3 months ago.

Status:
Open
Priority:
Normal
[ruby-core:104836]

Description

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

No data to display

Actions

Also available in: Atom PDF