diff --git a/featureflags_client/http/conditions.py b/featureflags_client/http/conditions.py index 1bec2cb..2adeca9 100644 --- a/featureflags_client/http/conditions.py +++ b/featureflags_client/http/conditions.py @@ -17,7 +17,7 @@ def except_false(func: Callable) -> Callable: def wrapper(ctx: Dict[str, Any]) -> Any: try: return func(ctx) - except TypeError: + except (TypeError, ValueError): return False return wrapper diff --git a/featureflags_client/tests/http/test_conditions.py b/featureflags_client/tests/http/test_conditions.py index 287e245..4d42bb1 100644 --- a/featureflags_client/tests/http/test_conditions.py +++ b/featureflags_client/tests/http/test_conditions.py @@ -98,6 +98,9 @@ def test_percent(): assert check_op(_UNDEFINED, percent, 100) is False + assert check_op("foo", percent, '100') is True + assert check_op("foo", percent, 'not_number') is False + def test_regexp(): assert check_op("anything", regexp, ".") is True