Problem
When a dependency can't be resolved, the error message is a flat string with no context about the resolution chain:
Argument db of type <class 'Database'> cannot be resolved. Trying to build dependency <class 'MyService'>.
For deep dependency graphs this makes it hard to understand where in the chain the failure occurred.
Proposed Solution
During recursive resolution in _compile_kwargs, catch resolution errors and re-raise with path context. Accumulate the dependency chain so the top-level error shows the full path from the initially requested type down to the missing dependency. Include scope at each level.
Example output:
Cannot resolve dependency chain:
APP MyService
APP └─> Repository
APP └─> Database (not registered)
Impact
Dramatically easier debugging, especially for deep dependency graphs.
Complexity
Medium — touches factory.py error handling in _compile_kwargs.
Problem
When a dependency can't be resolved, the error message is a flat string with no context about the resolution chain:
For deep dependency graphs this makes it hard to understand where in the chain the failure occurred.
Proposed Solution
During recursive resolution in
_compile_kwargs, catch resolution errors and re-raise with path context. Accumulate the dependency chain so the top-level error shows the full path from the initially requested type down to the missing dependency. Include scope at each level.Example output:
Impact
Dramatically easier debugging, especially for deep dependency graphs.
Complexity
Medium — touches
factory.pyerror handling in_compile_kwargs.