Skip to content

Commit

Permalink
Be more robust to publish errors (#2900)
Browse files Browse the repository at this point in the history
  • Loading branch information
martinbonnin committed Jan 26, 2021
1 parent 7bb04c0 commit 63bd112
Showing 1 changed file with 11 additions and 1 deletion.
Expand Up @@ -113,8 +113,18 @@ public RealApolloStore(@NotNull NormalizedCache normalizedCache, @NotNull CacheK
iterableSubscribers = new LinkedHashSet<>(subscribers);
}

RuntimeException firstException = null;
for (RecordChangeSubscriber subscriber : iterableSubscribers) {
subscriber.onCacheRecordsChanged(changedKeys);
try {
subscriber.onCacheRecordsChanged(changedKeys);
} catch (RuntimeException e) {
if (firstException == null) {
firstException = e;
}
}
}
if (firstException != null) {
throw firstException;
}
}

Expand Down

0 comments on commit 63bd112

Please sign in to comment.