Fix error propagation for attachment streams

Co-authored-by: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com>
This commit is contained in:
automated-signal 2024-07-19 22:21:35 -05:00 committed by GitHub
parent 0d20e52128
commit 3f373b48e6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -351,7 +351,7 @@ export async function handleAttachmentRequest(req: Request): Promise<Response> {
plaintext
);
} catch (error) {
plaintext.emit('error', error);
plaintext.destroy(error);
// These errors happen when canceling fetch from `attachment://` urls,
// ignore them to avoid noise in the logs.
@ -469,7 +469,7 @@ function handleRangeRequest({
try {
await pipeline(plaintext, transform);
} catch (error) {
transform.emit('error', error);
transform.destroy(error);
// These errors happen when canceling fetch from `attachment://` urls,
// ignore them to avoid noise in the logs.