From 2ae259092fce250b5485f0f4899dbf7d4f6d58ad Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Wed, 3 Mar 2021 09:29:03 +1100 Subject: [PATCH] fix propagation of WrongSwarmError in pollForAllKeys() --- ts/session/snode_api/swarmPolling.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ts/session/snode_api/swarmPolling.ts b/ts/session/snode_api/swarmPolling.ts index 5681e8a70..b31e3341c 100644 --- a/ts/session/snode_api/swarmPolling.ts +++ b/ts/session/snode_api/swarmPolling.ts @@ -208,10 +208,14 @@ export class SwarmPolling { const groupPromises = this.groupPubkeys.map(async pk => { return this.pollOnceForKey(pk, true); }); + // if a WrongSwarmError has been triggered, we have to forward it (and in fact we must forward any errors) + // but, we also need to make sure the next pollForAllKeys runs no matter if an error is triggered or not + // the finally here will be invoked even if the catch is throwing an exception try { await Promise.all(_.concat(directPromises, groupPromises)); } catch (e) { window.log.warn('pollForAllKeys swallowing exception: ', e); + throw e; } finally { setTimeout(this.pollForAllKeys.bind(this), 2000); }