Skip to content

Commit 3410898

Browse files
authored
Fix finally usage (#29)
* fix finally usage Signed-off-by: James Elias Sigurdarson <[email protected]> * also wrap in block Signed-off-by: James Elias Sigurdarson <[email protected]> * fix test Signed-off-by: James Elias Sigurdarson <[email protected]> * forgot to save Signed-off-by: James Elias Sigurdarson <[email protected]>
1 parent 85f5a4f commit 3410898

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/client.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,9 @@ export class FluentClient {
473473
}
474474
if (!this.emitQueue.has(emitPromise)) {
475475
this.emitQueue.add(emitPromise);
476-
emitPromise.finally(() => this.emitQueue.delete(emitPromise));
476+
emitPromise
477+
.finally(() => this.emitQueue.delete(emitPromise))
478+
.catch(() => {});
477479
}
478480
return emitPromise;
479481
}

src/util.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@ export const awaitAtMost = <T>(
1313
}, timeout))
1414
),
1515
]);
16-
racePromise.finally(() => (timeoutId ? clearTimeout(timeoutId) : undefined));
16+
racePromise
17+
.finally(() => {
18+
if (timeoutId) clearTimeout(timeoutId);
19+
})
20+
.catch(() => {});
1721
return racePromise;
1822
};
1923

0 commit comments

Comments
 (0)