-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: setProviderAndWait must throw #794
Conversation
try (AutoCloseableLock __ = lock.writeLockAutoCloseable()) { | ||
providerRepository.setProvider( | ||
provider, | ||
this::attachEventProvider, | ||
this::emitReady, | ||
this::detachEventProvider, | ||
this::emitError, | ||
this::emitErrorAndThrow, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the main change - I pass a new delegate which not only emits the events, but throws.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #794 +/- ##
============================================
+ Coverage 94.87% 95.13% +0.26%
- Complexity 366 368 +2
============================================
Files 34 34
Lines 858 863 +5
Branches 53 53
============================================
+ Hits 814 821 +7
+ Misses 23 22 -1
+ Partials 21 20 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
ee1d18b
to
9f453ba
Compare
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
ProviderEventDetails.builder().message(exception.getMessage()).build()); | ||
} | ||
|
||
private void emitErrorAndThrow(FeatureProvider provider, OpenFeatureError exception) throws OpenFeatureError { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New delegate which emits errors but also throws.
Quality Gate passedIssues Measures |
As per 1.1.2.4, the blocking provider setter must throw if init fails, so that application integrators can easily understand if their provider is working without attaching event handlers.
We implemented the wait functionality of this method, but we swallow the exception.
This PR fixes that.