From 949efca190434b4a43824829b7c3c61c795bd1bd Mon Sep 17 00:00:00 2001 From: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com> Date: Mon, 13 Feb 2023 12:27:12 -0800 Subject: [PATCH] Fix unhandled rejection in differential updater --- ts/updater/differential.ts | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/ts/updater/differential.ts b/ts/updater/differential.ts index 7acff7182..eec80e943 100644 --- a/ts/updater/differential.ts +++ b/ts/updater/differential.ts @@ -368,15 +368,19 @@ export async function downloadRanges( // Each `part` is a separate readable stream for one of the ranges const onPart = async (part: Dicer.PartStream): Promise => { - const diff = await takeDiffFromPart(part, diffByRange); + try { + const diff = await takeDiffFromPart(part, diffByRange); - await saveDiffStream({ - diff, - stream: part, - abortSignal, - output, - chunkStatusCallback, - }); + await saveDiffStream({ + diff, + stream: part, + abortSignal, + output, + chunkStatusCallback, + }); + } catch (error) { + dicer.destroy(error); + } }; let boundary: string;