Skip to content

Commit

Permalink
throw derived exception to invoke error hook with expected flow
Browse files Browse the repository at this point in the history
Signed-off-by: Kavindu Dodanduwa <kavindudodanduwa@gmail.com>
  • Loading branch information
Kavindu-Dodan committed May 28, 2024
1 parent 6bc1fd8 commit 5769409
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/main/java/dev/openfeature/sdk/OpenFeatureClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,7 @@ private <T> FlagEvaluationDetails<T> evaluateFlag(FlagValueType type, String key

details = FlagEvaluationDetails.from(providerEval, key);
if (details.getErrorCode() != null) {
Exception e = ExceptionUtils.instantiateErrorByErrorCode(details.getErrorCode(),
details.getErrorMessage());
hookSupport.errorHooks(type, hookCtx, e, mergedHooks, hints);
throw ExceptionUtils.instantiateErrorByErrorCode(details.getErrorCode(), details.getErrorMessage());
} else {
hookSupport.afterHooks(type, hookCtx, details, mergedHooks, hints);
}
Expand Down

0 comments on commit 5769409

Please sign in to comment.