Skip to content

LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows

Handling grpc.StatusCode.NOT_FOUND exception (#439)

ali78ae8f200605
diff --git a/unstract/flags/src/unstract/flags/client/evaluation.py b/unstract/flags/src/unstract/flags/client/evaluation.py
index fa5347289..3a4b2b785 100644
--- a/unstract/flags/src/unstract/flags/client/evaluation.py
+++ b/unstract/flags/src/unstract/flags/client/evaluation.py
@@ -51,8 +51,13 @@ class EvaluationClient(BaseClient):
response = self.stub.Boolean(request)
return bool(response.enabled)
except grpc.RpcError as e:
- logger.warning(
- f"Error evaluating feature flag '{flag_key}' for {namespace_key}"
- f": {str(e)}"
- )
+ if e.code() == grpc.StatusCode.NOT_FOUND:
+ logger.warning(
+ f"Flag key {flag_key} not found in namespace {namespace_key}."
+ )
+ else:
+ logger.warning(
+ f"Error evaluating feature flag {flag_key} for {namespace_key}"
+ f" : {str(e)}"
+ )
return False
diff --git a/unstract/flags/src/unstract/flags/feature_flag.py b/unstract/flags/src/unstract/flags/feature_flag.py
index 9133ba826..3094c00ca 100644
--- a/unstract/flags/src/unstract/flags/feature_flag.py
+++ b/unstract/flags/src/unstract/flags/feature_flag.py
@@ -38,6 +38,5 @@ def check_feature_flag_status(
context=context,
)
return bool(response) # Wrap the response in a boolean check
- except Exception as e:
- logger.warning(f"Error evaluating feature flag '{flag_key}': {str(e)}")
+ except Exception:
return False