[config][android] Explicitly handle task exception
This commit is contained in:
parent
01c274a2f1
commit
54743d945d
|
@ -16,6 +16,7 @@ import com.facebook.react.bridge.ReactApplicationContext;
|
|||
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
||||
import com.google.firebase.FirebaseApp;
|
||||
import com.google.firebase.remoteconfig.FirebaseRemoteConfig;
|
||||
import com.google.firebase.remoteconfig.FirebaseRemoteConfigFetchThrottledException;
|
||||
import com.google.firebase.remoteconfig.FirebaseRemoteConfigValue;
|
||||
import com.google.firebase.remoteconfig.FirebaseRemoteConfigSettings;
|
||||
|
||||
|
@ -121,7 +122,11 @@ class RNFirebaseRemoteConfig extends ReactContextBaseJavaModule {
|
|||
if (task.isSuccessful()) {
|
||||
promise.resolve("remoteConfigFetchStatusSuccess");
|
||||
} else {
|
||||
promise.reject("config/failure", task.getException().getMessage(), task.getException());
|
||||
if (task.getException() instanceof FirebaseRemoteConfigFetchThrottledException) {
|
||||
promise.reject("config/throttled", "fetch() operation cannot be completed successfully, due to throttling.", task.getException());
|
||||
} else {
|
||||
promise.reject("config/failure", "fetch() operation cannot be completed successfully.", task.getException());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue