Drop noisy AbortErrors in attachment_channel

This commit is contained in:
Fedor Indutny 2024-07-16 11:27:10 -07:00 committed by GitHub
parent 373540a996
commit 826b361757
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -352,11 +352,18 @@ export async function handleAttachmentRequest(req: Request): Promise<Response> {
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);
}
})()
);