From 345633b1e32ee63a215250901a0fe7fe914a8d1c Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Fri, 5 Aug 2022 11:43:15 -0400 Subject: [PATCH] Common: Document exceptions for DIContainer --- monkey/common/di_container.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/monkey/common/di_container.py b/monkey/common/di_container.py index b7b6b5e79..744e813d8 100644 --- a/monkey/common/di_container.py +++ b/monkey/common/di_container.py @@ -31,6 +31,7 @@ class DIContainer: :param interface: An interface or abstract base class that other classes depend upon :param concrete_type: A `type` (class) that implements `interface` + :raises TypeError: If `concrete_type` is not a class, or not a subclass of `interface` """ if not inspect.isclass(concrete_type): raise TypeError( @@ -54,6 +55,7 @@ class DIContainer: :param interface: An interface or abstract base class that other classes depend upon :param instance: An instance (object) of a `type` that implements `interface` + :raises TypeError: If `instance` is not an instance of `interface` """ if not isinstance(instance, interface): raise TypeError( @@ -106,6 +108,7 @@ class DIContainer: :param **type_**: A `type` (class) to construct :return: An instance of **type_** + :raises UnresolvableDependencyError: If any dependencies could not be successfully resolved """ try: return self._resolve_type(type_) @@ -125,6 +128,7 @@ class DIContainer: :param **type_**: A type (class) to resolve dependencies for :return: An Sequence of dependencies to be injected into `type_`'s constructor + :raises UnresolvableDependencyError: If any dependencies could not be successfully resolved """ args = []