Common: Use suppress (not pass) in DIContainer.resolve()

This commit is contained in:
Mike Salvatore 2022-08-08 07:00:49 -04:00
parent 345633b1e3
commit b2d32697e3
1 changed files with 2 additions and 3 deletions

View File

@ -1,4 +1,5 @@
import inspect
from contextlib import suppress
from typing import Any, Sequence, Type, TypeVar
from common.utils.code_utils import del_key
@ -110,10 +111,8 @@ class DIContainer:
:return: An instance of **type_**
:raises UnresolvableDependencyError: If any dependencies could not be successfully resolved
"""
try:
with suppress(UnresolvableDependencyError):
return self._resolve_type(type_)
except UnresolvableDependencyError:
pass
args = self.resolve_dependencies(type_)
return type_(*args)