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 <[email protected]>
  • Loading branch information
Kavindu-Dodan committed May 30, 2024
1 parent 1ca84c0 commit 380b177
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 380b177

Please sign in to comment.