Estimote / react-native-proximity

React Native wrapper for Estimote Proximity SDK
Apache License 2.0
61 stars 38 forks source link

No devices assigned to tags #61

Open Sideral-Inc opened 4 years ago

Sideral-Inc commented 4 years ago

Hi,

Currently testing this library and figured out that if you specify a zone with a tag that doesn't exist in the cloud, it will generate an error:

RNEP.locationPermission.request().then((permission) => {
    if(permission !== RNEP.locationPermission.DENIED) {
        const credentials = new RNEP.CloudCredentials(***, ***);
        const initializeOptions = {
            notification: {
                title: "Exploration mode is on",
                text: "We'll notify you when you're next to something interesting.",
                channel: {
                    id: "exploration-mode",
                    name: "Exploration Mode"
                }
            }
        };

        RNEP.proximityObserver.initialize(credentials, initializeOptions);
        RNEP.proximityObserver.startObservingZones(proximityZones);
    }
}, (error) => {
    console.error("Error when trying to obtain location permission", error);
});

And got the following:

Proximity Observer error: Error Domain=EPXProximityObserverErrorDomain Code=1 "Fetching tags from Cloud failed." UserInfo={NSUnderlyingError=0x2804e74d0 {Error Domain=EstimoteProximitySDK.PersistentTagsRepository.Error Code=0 "No devices assigned to tags: ["tag1", "tag1", "tag1"]. Please double check in Cloud you have properly tagged your devices."}, NSLocalizedDescription=Fetching tags from Cloud failed., NSLocalizedRecoverySuggestion=Make sure your cloud credentials are correct and you have a valid internet connection. See CloudCredentials for more.}

Would it be possible to return an error message instead of throwing an error that blocks the app for this?