-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathFatalErrorProvider.java
45 lines (35 loc) · 1.54 KB
/
FatalErrorProvider.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package dev.openfeature.sdk;
import dev.openfeature.sdk.exceptions.FatalError;
import dev.openfeature.sdk.exceptions.GeneralError;
public class FatalErrorProvider implements FeatureProvider {
private final String name = "fatal";
@Override
public Metadata getMetadata() {
return () -> name;
}
@Override
public void initialize(EvaluationContext evaluationContext) throws Exception {
throw new FatalError(); // throw a fatal error on startup (this will cause the SDK to short circuit evaluations)
}
@Override
public ProviderEvaluation<Boolean> getBooleanEvaluation(String key, Boolean defaultValue, EvaluationContext ctx) {
throw new GeneralError(TestConstants.BROKEN_MESSAGE);
}
@Override
public ProviderEvaluation<String> getStringEvaluation(String key, String defaultValue, EvaluationContext ctx) {
throw new GeneralError(TestConstants.BROKEN_MESSAGE);
}
@Override
public ProviderEvaluation<Integer> getIntegerEvaluation(String key, Integer defaultValue, EvaluationContext ctx) {
throw new GeneralError(TestConstants.BROKEN_MESSAGE);
}
@Override
public ProviderEvaluation<Double> getDoubleEvaluation(String key, Double defaultValue, EvaluationContext ctx) {
throw new GeneralError(TestConstants.BROKEN_MESSAGE);
}
@Override
public ProviderEvaluation<Value> getObjectEvaluation(
String key, Value defaultValue, EvaluationContext invocationContext) {
throw new GeneralError(TestConstants.BROKEN_MESSAGE);
}
}