Skip to content

4.0: consistent exception attributes and exports #563

Closed

Description

@lesnik512

This was generated by AI during a pre-4.0 audit of main at 9cd88e7.

Observation

  • Parameter names: arg_name (ArgumentResolutionError, ContextValueNotSetError) vs parameter_name (UnsupportedCreatorParameterError, InvalidScopeDependencyError).
  • ContextValueNotSetError.__init__(scope_name: str) (exceptions/resolution.py:181) takes a string; every other scope-bearing error stores an IntEnum (provider_scope, container_scope, scope).
  • ArgumentResolutionError(bound_type=...) also receives the creator callable when there is no bound type (providers/factory.py:158), and member_types is accepted but not stored, unlike arg_type (exceptions/resolution.py:65-77).
  • exceptions.__all__ exports DependencyPathMixin and SUGGESTION_HEADER, which have no use outside the package (exceptions/__init__.py).
  • AliasSourceNotRegisteredError still says "Register a provider for X before defining the alias" (exceptions/resolution.py:54); since perf(alias): bind an Alias to its source at compile time #559 the source only has to be registered before the first resolve.

Proposal

  • One parameter attribute name across exceptions.
  • ContextValueNotSetError(scope: IntEnum); render .name.
  • Split ArgumentResolutionError.bound_type into bound_type and creator; store member_types.
  • Drop DependencyPathMixin and SUGGESTION_HEADER from __all__.
  • Fix the alias message.
  • Migration guide entries for every renamed attribute.

Acceptance

Tests assert the new attributes; rendered messages unchanged except the alias one; docs and migration guide updated.

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

    enhancementNew feature or requestready-for-agentFully specified, ready for an AFK agent

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions