Skip to content

get_config: default config_not_found_exceptions=(Exception,) hides real errors (split from #16, item 2) #25

Description

@thorwhalen

Split out of #16 (item 2) so it can be decided on its own.

Problem

get_config, FuncBasedGettableContainer, gettable_containers, sources_chainmap and user_gettable (all in config2py/base.py) default config_not_found_exceptions to (Exception,). Any error raised by a callable source (network blip, bug, missing import, bad credentials) is treated as "not found", and the lookup silently falls through to the next, often less trusted, source (ending at the user prompt).

Why this was not changed unattended

Narrowing the default changes which errors propagate for every existing caller, and config2py has ~30 fleet dependents. For example oa builds get_config(sources=[store, os.environ, user_gettable(store)]) and relies on the fall-through. The docstring of get_config now warns about the broad default (cloud-sweep PR); the behaviour is unchanged.

Proposed plan (for a local session with the full dependents set)

  1. Add a module constant DFLT_CONFIG_NOT_FOUND_EXCEPTIONS = (KeyError, LookupError, FileNotFoundError, ConfigNotFound) but keep (Exception,) as the effective default for one release, emitting a DeprecationWarning when a non-lookup exception is swallowed.
  2. Flip the default the next release, after running every dependent listed in fleet_dependents.json.
  3. Test: a callable source raising RuntimeError must propagate under the new default and fall through when config_not_found_exceptions=(Exception,) is passed explicitly.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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