Skip to content

Include dependency path in resolution error messages#179

Merged
lesnik512 merged 1 commit intomainfrom
170-include-dependency-path-in-resolution-error-messages
May 2, 2026
Merged

Include dependency path in resolution error messages#179
lesnik512 merged 1 commit intomainfrom
170-include-dependency-path-in-resolution-error-messages

Conversation

@lesnik512
Copy link
Copy Markdown
Member

Adds ResolutionStep and a dependency_path / prepend_step / str override on ResolutionError so resolution failures accumulate the chain of providers being resolved as the exception propagates up. Factory.resolve wraps the kwargs resolution block with a single try/except that prepends self and re-raises; the leaf message stays unchanged when the path is empty.

Path support is scoped to ResolutionError (not the broad ModernDIError) since build-time and registration errors don't conceptually carry a chain.

Closes #170

Adds ResolutionStep and a dependency_path / prepend_step / __str__ override on
ResolutionError so resolution failures accumulate the chain of providers being
resolved as the exception propagates up. Factory.resolve wraps the kwargs
resolution block with a single try/except that prepends self and re-raises;
the leaf message stays unchanged when the path is empty.

Path support is scoped to ResolutionError (not the broad ModernDIError) since
build-time and registration errors don't conceptually carry a chain.

Closes #170

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@lesnik512 lesnik512 self-assigned this May 2, 2026
@lesnik512 lesnik512 linked an issue May 2, 2026 that may be closed by this pull request
@lesnik512 lesnik512 merged commit aa89a57 into main May 2, 2026
6 checks passed
@lesnik512 lesnik512 deleted the 170-include-dependency-path-in-resolution-error-messages branch May 2, 2026 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Include dependency path in resolution error messages

1 participant