Project

General

Profile

Actions

Feature #16043

closed

`$LOAD_PATH.resolve_feature_path` should not raise

Added by deivid (David Rodríguez) over 4 years ago. Updated about 3 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:94135]

Description

When I first tried this method, I was expecting it to return nil when the given feature is not found. This is because I read in the docs and discussion that this method only searches the feature in the LOAD_PATH, but does not attempt to load it. Raising a load error makes it look that this method tries to load the feature, but I don't think it does that.

Also returning nil seems friendlier to me because the "feature not found" case is more like an expected outcome of the method than a real error condition, so in most usages this error will actually be rescued for control flow.

I attach a patch with the change, and link to the GH PR: https://github.com/ruby/ruby/pull/2317.


Files

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0