-
Notifications
You must be signed in to change notification settings - Fork 42
Description
I have created a custom condition that doesn't require request object and works fine.
But issue is a runtime error occurs when by mistake a user adds a flag with a condition that requires requests, making my code to fail at runtime with request is not required.
For instance using flags in celery tasks.
At the moment am doing this hack
``
from flags import conditions
def patched_check(self, **kwargs):
if self.fn is not None:
try:
return self.fn(self.value, **kwargs)
except Exception as e:
logger.exception(f"Error checking condition {self.condition}: {e}")
return False
return False
Apply the monkey patch
Condition.check = patched_check
``
Is this something that should be contributed back to support exceptions and just return false
i.e
flag_enabled("feature_flag", handle_exception=True)