Skip to content

Option to Raise Error for Missing extra_sources Files #381

@nna774

Description

@nna774

Thank you for implementing config.extra_sources in PR #366 ! I personally had a monkey patch in place to achieve similar functionality, and this new feature allowed me to remove it entirely, which is fantastic.

Currently, if a file specified in config.extra_sources does not exist, it is silently skipped. For example, the following code:

Config.setup do |config|
  config.extra_sources = ['does_not_exists.yml']
end

will not raise an error. This behavior appears to stem from the implementation around

if @path and File.exist?(@path)

Expected Behavior / Feature Request:
I propose adding an option to make Config raise an error (e.g., FileNotFoundError or a custom Config::Error) when a file listed in config.extra_sources does not exist.

The current silent failure can make it difficult to identify misconfigurations or typos in file paths. Explicitly raising an error would provide immediate feedback, aiding in debugging and ensuring that all intended configuration sources are loaded.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions