Skip to content

Add smart suggestions to resolution error messages #171

@lesnik512

Description

@lesnik512

Problem

When a type isn't found in the provider registry, the error message offers no guidance:

Provider of type <class 'Database'> is not registered in providers registry.

Proposed Solution

When a type lookup fails, scan registered providers to generate actionable hints:

  1. Is the type registered but at a different scope than the resolving container? → "Try resolving from a container with scope X"
  2. Is a parent class or subclass of the requested type registered? → "Did you mean ConcreteDatabase?"
  3. Is the type name similar to a registered type? → typo detection

Append hints to the error message.

Impact

Reduces time-to-fix for common wiring mistakes from minutes to seconds.

Complexity

Medium — touches providers_registry.py and errors.py.

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