Fix error propagation for attachment streams

This commit is contained in:
Fedor Indutny 2024-07-19 10:50:47 -07:00 committed by GitHub
parent 1fd8b0ef23
commit b8ef9e5cbc
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.