fix: provider exceptions crash the caller#97
Conversation
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
There was a problem hiding this comment.
Code Review
This pull request updates the FeatureProvider interface and its implementations, including InMemoryProvider and NoopProvider, to return absl::StatusOr<std::unique_ptr<...>> for all flag evaluation methods. This change standardizes error reporting and explicitly discourages the use of C++ exceptions. Corresponding updates were made to the ClientAPI, test suites, and mocks to handle the new return types. Feedback suggests adding a null check for the unique_ptr within the absl::StatusOr in openfeature/client_api.h to prevent potential crashes if a provider returns an OK status with a null pointer.
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
There was a problem hiding this comment.
Mostly LGTM. A few things:
- No tests for the 3 new branches in EvaluateFlag; cheap to add with MockFeatureProvider + a small throwing mock.
- Gemini's null-check point seems right
- I think this breaks the
FeatureProvider(correct me if I'm wrong, I'm not that strong at C++). That's totally fine since we are not 1.0, but we should use afix!:prefix.
I'll approve now, up to you to make these changes if you agree. ❤️
This PR
Resolves the issue where feature provider errors could propagate and crash the caller during flag evaluation.
To satisfy Requirement 1.4.10 while strictly adhering to the Google C++ Style Guide's zero-exception rules, this PR refactors the evaluation boundary to use compile-time contractual safety:
FeatureProviderevaluation interface to returnabsl::StatusOr.Related Issues
Fixes #69
Follow-up Tasks