python-dependency-injector
python-dependency-injector copied to clipboard
Feature request: Raise an error if dependency is missing with `@inject`
I am currently trying to achieve something with the dependency injection. I am not aware if this is already possible, but if it is, feel free to just point me to the right documentation and close this issue.
So basically, I am using @inject to automatically inject some dependencies into various functions, and I just got an issue in production because one of the required dependency was wrongly referenced by name, and the framework injected None instead of logging / raising an error.
What I would like is for my application to crash at startup if some dependency required does not exist. This way, we could catch the dependency injection issues much earlier than in production.
Is it something that is possible at the moment? If not, is it a possible feature we could get? An idea could be simply with a parameter : @inject(raise_if_not_found=True)
Thanks in advance