|
28 | 28 | ) |
29 | 29 | from ldclient.impl.client_common import secure_mode_hash as _secure_mode_hash |
30 | 30 | from ldclient.impl.datasystem import AsyncDataSystem, DataAvailability |
31 | | -from ldclient.impl.evaluator_common import error_reason |
| 31 | +from ldclient.impl.evaluator_common import error_reason, is_override_definition |
32 | 32 | from ldclient.impl.events.async_event_processor import ( |
33 | 33 | DefaultAsyncEventProcessor |
34 | 34 | ) |
@@ -553,6 +553,10 @@ def not_ready() -> Tuple[EvaluationDetail, Optional[FeatureFlag]]: |
553 | 553 | log.error("Unexpected error while evaluating feature flag \"%s\": %s" % (key, repr(e))) |
554 | 554 | log.debug(traceback.format_exc()) |
555 | 555 | reason = error_reason('EXCEPTION') |
| 556 | + # The evaluation read the flag definition before it failed, so a definition from |
| 557 | + # the override layer marks the result. |
| 558 | + if is_override_definition(flag): |
| 559 | + reason['overrideAffected'] = True |
556 | 560 | self._send_event(event_factory.new_default_event(flag, context, default, reason)) |
557 | 561 | return EvaluationDetail(default, None, reason), flag |
558 | 562 |
|
@@ -646,7 +650,11 @@ async def all_flags_state(self, context: Context, **kwargs) -> FeatureFlagsState |
646 | 650 | except Exception as e: |
647 | 651 | log.error("Error evaluating flag \"%s\" in all_flags_state: %s" % (key, repr(e))) |
648 | 652 | log.debug(traceback.format_exc()) |
649 | | - reason = {'kind': 'ERROR', 'errorKind': 'EXCEPTION'} |
| 653 | + reason = error_reason('EXCEPTION') |
| 654 | + # The evaluation read the flag definition before it failed, so a definition from |
| 655 | + # the override layer marks the result. |
| 656 | + if is_override_definition(flag): |
| 657 | + reason['overrideAffected'] = True |
650 | 658 | detail = EvaluationDetail(None, None, reason) |
651 | 659 | prerequisites = [] |
652 | 660 | requires_experiment_data = EventFactory.is_experiment(flag, detail.reason) |
|
0 commit comments