Skip to content

Commit a36579b

Browse files
committed
fix: address review comments
1 parent 4d1b078 commit a36579b

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

open_feature/provider/in_memory_provider.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ def _resolve(
116116
if flag is None:
117117
return FlagResolutionDetails(
118118
value=default_value,
119-
reason=Reason.DEFAULT,
120-
variant=PASSED_IN_DEFAULT,
119+
reason=Reason.ERROR,
120+
error_code=ErrorCode.FLAG_NOT_FOUND,
121+
error_message=f"Flag '{flag_key}' not found",
121122
)
122123
return flag.resolve(evaluation_context)

tests/provider/test_in_memory_provider.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from numbers import Number
22

3+
from open_feature.exception.error_code import ErrorCode
34
from open_feature.flag_evaluation.reason import Reason
45
from open_feature.flag_evaluation.resolution_details import FlagResolutionDetails
56
from open_feature.provider.in_memory_provider import InMemoryProvider, InMemoryFlag
@@ -24,8 +25,9 @@ def test_should_handle_unknown_flags_correctly():
2425
assert flag is not None
2526
assert flag.value is True
2627
assert isinstance(flag.value, bool)
27-
assert flag.reason == Reason.DEFAULT
28-
assert flag.variant == "Passed in default"
28+
assert flag.reason == Reason.ERROR
29+
assert flag.error_code == ErrorCode.FLAG_NOT_FOUND
30+
assert flag.error_message == "Flag 'Key' not found"
2931

3032

3133
def test_calls_context_evaluator_if_present():

0 commit comments

Comments
 (0)