Skip to content

Commit

Permalink
fix: better exception for @resolve with no key
Browse files Browse the repository at this point in the history
  • Loading branch information
z3z1ma committed Jul 28, 2024
1 parent f20ac0c commit 5032a00
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/cdf/core/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,8 @@ def apply_converters(
raise ValueError(
"Resolver instance not provided but found @resolve converter"
)
if transformed_value not in resolver:
raise ValueError(f"Key not found in resolver: {transformed_value}")
transformed_value = resolver[transformed_value]
continue
transformed_value = _CONVERTERS[converter.lower()](transformed_value)
Expand Down
2 changes: 2 additions & 0 deletions tests/core/injector/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,5 @@ def bar(user: str, password: str, database: str):

bar_configured = resolver.resolve_defaults(bar)
assert bar_configured() == ("someone", "secret", "test")

assert "main_api" in resolver

0 comments on commit 5032a00

Please sign in to comment.