From 826b361757e9b61e500a440146d131bcefd8c956 Mon Sep 17 00:00:00 2001 From: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com> Date: Tue, 16 Jul 2024 11:27:10 -0700 Subject: [PATCH] Drop noisy AbortErrors in attachment_channel --- app/attachment_channel.ts | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/app/attachment_channel.ts b/app/attachment_channel.ts index 1698fe28d5..1160d62098 100644 --- a/app/attachment_channel.ts +++ b/app/attachment_channel.ts @@ -352,11 +352,18 @@ export async function handleAttachmentRequest(req: Request): Promise { plaintext ); } catch (error) { + plaintext.emit('error', error); + + // These errors happen when canceling fetch from `attachment://` urls, + // ignore them to avoid noise in the logs. + if (error.name === 'AbortError') { + return; + } + console.error( 'handleAttachmentRequest: decryption error', Errors.toLogFormat(error) ); - plaintext.emit('error', error); } } @@ -463,11 +470,18 @@ function handleRangeRequest({ try { await pipeline(plaintext, transform); } catch (error) { + transform.emit('error', error); + + // These errors happen when canceling fetch from `attachment://` urls, + // ignore them to avoid noise in the logs. + if (error.name === 'AbortError') { + return; + } + console.error( 'handleAttachmentRequest: range transform error', Errors.toLogFormat(error) ); - transform.emit('error', error); } })() );