@@ -295,37 +295,39 @@ def evaluate_flag_details( # noqa: PLR0915
295295 reversed_merged_hooks = merged_hooks [:]
296296 reversed_merged_hooks .reverse ()
297297
298- status = self .get_provider_status ()
299- if status == ProviderStatus .NOT_READY :
300- error_hooks (
301- flag_type ,
302- hook_context ,
303- ProviderNotReadyError (),
304- reversed_merged_hooks ,
305- hook_hints ,
306- )
307- return FlagEvaluationDetails (
308- flag_key = flag_key ,
309- value = default_value ,
310- reason = Reason .ERROR ,
311- error_code = ErrorCode .PROVIDER_NOT_READY ,
312- )
313- if status == ProviderStatus .FATAL :
314- error_hooks (
315- flag_type ,
316- hook_context ,
317- ProviderFatalError (),
318- reversed_merged_hooks ,
319- hook_hints ,
320- )
321- return FlagEvaluationDetails (
322- flag_key = flag_key ,
323- value = default_value ,
324- reason = Reason .ERROR ,
325- error_code = ErrorCode .PROVIDER_FATAL ,
326- )
327-
328298 try :
299+ status = self .get_provider_status ()
300+ if status == ProviderStatus .NOT_READY :
301+ error_hooks (
302+ flag_type ,
303+ hook_context ,
304+ ProviderNotReadyError (),
305+ reversed_merged_hooks ,
306+ hook_hints ,
307+ )
308+ flag_evaluation = FlagEvaluationDetails (
309+ flag_key = flag_key ,
310+ value = default_value ,
311+ reason = Reason .ERROR ,
312+ error_code = ErrorCode .PROVIDER_NOT_READY ,
313+ )
314+ return flag_evaluation
315+ if status == ProviderStatus .FATAL :
316+ error_hooks (
317+ flag_type ,
318+ hook_context ,
319+ ProviderFatalError (),
320+ reversed_merged_hooks ,
321+ hook_hints ,
322+ )
323+ flag_evaluation = FlagEvaluationDetails (
324+ flag_key = flag_key ,
325+ value = default_value ,
326+ reason = Reason .ERROR ,
327+ error_code = ErrorCode .PROVIDER_FATAL ,
328+ )
329+ return flag_evaluation
330+
329331 # https://github.com/open-feature/spec/blob/main/specification/sections/03-evaluation-context.md
330332 # Any resulting evaluation context from a before hook will overwrite
331333 # duplicate fields defined globally, on the client, or in the invocation.
0 commit comments