Skip to content

Commit

Permalink
add hack type checking
Browse files Browse the repository at this point in the history
  • Loading branch information
biniona committed Sep 30, 2024
1 parent 41c9a4e commit 838d369
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions minject/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,10 @@ def resolve(self, key: "RegistryKey[T]") -> T:
return self[key]

async def aresolve(self, key: "RegistryKey[T]") -> T:
return await self._aget(key)
result = await self._aget(key)
if result is None:
raise KeyError(key, "could not be resolved")
return result

async def push_async_context(self, key: Any) -> Any:
result = await self._async_context_stack.enter_async_context(key)
Expand Down Expand Up @@ -364,7 +367,7 @@ async def _aget(

async def aget(
self, key: "RegistryKey[T]", default: Optional[Union[T, _AutoOrNone]] = None
) -> T:
) -> Optional[T]:
"""
Async API for getting objects
"""
Expand Down

0 comments on commit 838d369

Please sign in to comment.