InversifyJS: Idea: Exception-less failure to resolve from the container
I have some scenarios where I’d like to allow for optional bindings when doing lookups against the container.
Currently, to support this I have to put try { } catch { }
blocks around my container.get(...)
calls, which works but is obviously a little verbose.
Is there any merit in offering a default value when attempting to resolve from the container and when the resolution doesn’t find anything, the default is returned instead?
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 2
- Comments: 17 (6 by maintainers)
I like A more, there also can be
getOptional
: