python-dependency-injector
python-dependency-injector copied to clipboard
Strict Mode / Better Errors when dependency is missing
I've been using this library for a while, and its great. I am often using strings to reference my dependencies, e.g. Provide['stuff']. And I have different application containers that support different configurations of applications.
Right now, if I forget a key dependency for a specific container, I end up getting an error that looks like this:
AttributeError: 'Provide' object has no attribute 'get_by_user_id'
This is because DI could not find the dependency. I would rather that the DI framework itself just threw a more descriptive error, e.g. "XYZ Dependency Not Found"
In my eyes it would be even better to raise an error while wiring so it breaks python process while analysing code for places to inject deps. Otherwise you will get this feedback while executing specific code.