Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Silence LoadError only if it is for rubygems itself #4719

Merged
merged 1 commit into from
Aug 18, 2021

Conversation

intuxicated
Copy link
Contributor

@intuxicated intuxicated commented Aug 8, 2021

Background

#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 (rubygems/rubygems#4824). Although #2764 intention was to prevent failure when 'rubygems' are not available, it's capturing every LoadError that might happen inside the rubygems at runtime.

Change

Prevent raising the LoadError exception only if it's related directly to loading rubygems.

gem_prelude.rb Outdated Show resolved Hide resolved
Co-authored-by: David Rodríguez <deivid.rodriguez@riseup.net>
Co-authored-by: Hiroshi SHIBATA <hsbt@ruby-lang.org>
@hsbt hsbt merged commit 0b7969b into ruby:master Aug 18, 2021
@intuxicated intuxicated deleted the dan/fix-rubygems-load-error branch August 18, 2021 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants