Skip to content

Commit

Permalink
fixup! Add evaluation details to finally hook stage #403
Browse files Browse the repository at this point in the history
Signed-off-by: christian.lutnik <[email protected]>
  • Loading branch information
chrfwow committed Jan 28, 2025
1 parent 6f71842 commit 07b512e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions openfeature/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,15 @@ def evaluate_flag_details( # noqa: PLR0915
return flag_evaluation

finally:
if flag_evaluation is None: # should never happen, but keeps the linter happy
flag_evaluation = FlagEvaluationDetails(
flag_key=flag_key,
value=default_value,
reason=Reason.ERROR,
error_code=ErrorCode.GENERAL,
error_message="Unknown error",
)

after_all_hooks(
flag_type,
hook_context,
Expand Down
1 change: 1 addition & 0 deletions tests/features/steps/hooks_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def convert_value_from_flag_type(value, flag_type):
return float(value)
return value


@then('"{hook_names}" hooks should have evaluation details')
def step_impl_should_have_eval_details(context, hook_names):
for hook_name in hook_names.split(", "):
Expand Down

0 comments on commit 07b512e

Please sign in to comment.