-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add delegate to capture misconfigured feature flags #72
Add delegate to capture misconfigured feature flags #72
Conversation
@josephwoodward @zhenlan why do we need a callback instead of a switch like the already existing: |
I do see some comments regarding the capability to set all missing features to true via the callback. I'm not sure what the use case for that would be though? In that case I would expect that a feature really should be configured to true. Depending on any behavior regarding missing features can be dangerous which is exactly what the original issue is mentioning. |
A switch forces your application to either throw an exception or lose any visibility of a missing feature configuration. For instance, if someone were to inadvertently clean up the wrong feature configuration within my Cloud provider of choice then my application would start erroring. This PR proposes adding a callback to enable the consumer to choose how a missing feature configuration is interpreted (log it as an error/warning for instance) I have no strong opinion on the returned boolean though, personally I'd rather it always returned false. |
@josephwoodward I don't think the callback is the way to go here. Is it true that all calls to the feature manager for a missing feature should behave the same? Perhaps, perhaps not. It's not really standard usage for the library, and I would argue that it is an exceptional state. In that case I would think our best bet would be to stick with standard error propagation via an exception. With that approach, if any logging is needed, then the proper exception could be caught, logged, and rethrown. Or if the application wishes, it could be swallowed. |
@jimmyca15 I see. At the moment this library does not throw an exception if the configuration is missing so it's not such an issue. With this in mind what are your thoughts on the way forward with the initial issue posed in #68? |
This pull request aims to address #68. I'm interested in your thoughts so any comments then I can update accordingly.