Skip to content

Commit 64e363a

Browse files
committed
simplify _assert_provider_status, remove row from README
Signed-off-by: leohoare <[email protected]>
1 parent e7b951e commit 64e363a

File tree

2 files changed

+4
-50
lines changed

2 files changed

+4
-50
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ print("Value: " + str(flag_value))
109109
|| [Eventing](#eventing) | React to state changes in the provider or flag management system. |
110110
|| [Shutdown](#shutdown) | Gracefully clean up a provider during application shutdown. |
111111
|| [Transaction Context Propagation](#transaction-context-propagation) | Set a specific [evaluation context](/docs/reference/concepts/evaluation-context) for a transaction (e.g. an HTTP request or a thread) |
112-
|| [Asynchronous Feature Retrieval](#asynchronous-feature-retrieval) | Evaluate flags in an asychronous context. |
113112
|| [Extending](#extending) | Extend OpenFeature with custom providers and hooks. |
114113

115114
<sub>Implemented: ✅ | In-progress: ⚠️ | Not implemented yet: ❌</sub>

openfeature/client.py

Lines changed: 4 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -465,31 +465,12 @@ def _establish_hooks_and_provider(
465465

466466
def _assert_provider_status(
467467
self,
468-
flag_type: FlagType,
469-
hook_context: HookContext,
470-
reversed_merged_hooks: typing.List[Hook],
471-
hook_hints: HookHints,
472468
) -> typing.Union[None, ErrorCode]:
473469
status = self.get_provider_status()
474-
475470
if status == ProviderStatus.NOT_READY:
476-
error_hooks(
477-
flag_type,
478-
hook_context,
479-
ProviderNotReadyError(),
480-
reversed_merged_hooks,
481-
hook_hints,
482-
)
483-
return ErrorCode.PROVIDER_NOT_READY
471+
raise ProviderNotReadyError()
484472
if status == ProviderStatus.FATAL:
485-
error_hooks(
486-
flag_type,
487-
hook_context,
488-
ProviderFatalError(),
489-
reversed_merged_hooks,
490-
hook_hints,
491-
)
492-
return ErrorCode.PROVIDER_FATAL
473+
raise ProviderFatalError()
493474
return None
494475

495476
def _before_hooks_and_merge_context(
@@ -549,20 +530,7 @@ async def evaluate_flag_details_async(
549530
)
550531

551532
try:
552-
error_code = self._assert_provider_status(
553-
flag_type,
554-
hook_context,
555-
reversed_merged_hooks,
556-
hook_hints,
557-
)
558-
if error_code:
559-
flag_evaluation = FlagEvaluationDetails(
560-
flag_key=flag_key,
561-
value=default_value,
562-
reason=Reason.ERROR,
563-
error_code=error_code,
564-
)
565-
return flag_evaluation
533+
self._assert_provider_status()
566534

567535
merged_context = self._before_hooks_and_merge_context(
568536
flag_type,
@@ -658,20 +626,7 @@ def evaluate_flag_details(
658626
)
659627

660628
try:
661-
error_code = self._assert_provider_status(
662-
flag_type,
663-
hook_context,
664-
reversed_merged_hooks,
665-
hook_hints,
666-
)
667-
if error_code:
668-
flag_evaluation = FlagEvaluationDetails(
669-
flag_key=flag_key,
670-
value=default_value,
671-
reason=Reason.ERROR,
672-
error_code=error_code,
673-
)
674-
return flag_evaluation
629+
self._assert_provider_status()
675630

676631
merged_context = self._before_hooks_and_merge_context(
677632
flag_type,

0 commit comments

Comments
 (0)