diff options
author | 2017-11-30 16:11:59 -0500 | |
---|---|---|
committer | 2017-11-30 16:11:59 -0500 | |
commit | 64204886af165557792a0a51954ae2a00fa3a02f (patch) | |
tree | c521a0c5d762017e0fc15ac66777c73fa22f5232 /Firestore/Source | |
parent | 4ec5f00b1dec8220c1e458d852eecd602dd56b8f (diff) |
Warn user if we raise with empty while not online
To avoid surprise by adding a warning. Right now, when offline, empty result is returned with no log nor error, see https://groups.google.com/forum/#!topic/google-cloud-firestore-discuss/puFl9HVU57I/discussion
Diffstat (limited to 'Firestore/Source')
-rw-r--r-- | Firestore/Source/Core/FSTEventManager.m | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Firestore/Source/Core/FSTEventManager.m b/Firestore/Source/Core/FSTEventManager.m index 3e1b99b..ec03eb7 100644 --- a/Firestore/Source/Core/FSTEventManager.m +++ b/Firestore/Source/Core/FSTEventManager.m @@ -20,6 +20,7 @@ #import "Firestore/Source/Core/FSTSyncEngine.h" #import "Firestore/Source/Model/FSTDocumentSet.h" #import "Firestore/Source/Util/FSTAssert.h" +#import "Firestore/Source/Util/FSTLogger.h" NS_ASSUME_NONNULL_BEGIN @@ -179,6 +180,11 @@ NS_ASSUME_NONNULL_BEGIN return NO; } + // Warn user if we raise initial event with empty documents while we are not actually online. + if (snapshot.documents.isEmpty && onlineState != FSTOnlineStateHealthy) { + FSTWarn(@"Could not reach Firestore backend."); + } + // Raise data from cache if we have any documents or we are offline return !snapshot.documents.isEmpty || onlineState == FSTOnlineStateFailed; } |