0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-02-24 22:46:02 -05:00

fix(errors): Remove duplicate logging of errors (#10197)

* fix(errors): Remove duplicate logging of errors

* chore: changeset
This commit is contained in:
Erika 2024-02-22 16:41:05 +01:00 committed by GitHub
parent 598f30c7cd
commit c856c72940
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 3 deletions

View file

@ -0,0 +1,5 @@
---
"astro": patch
---
Fixes errors being logged twice in some cases

View file

@ -83,9 +83,8 @@ export async function writeWebResponse(res: http.ServerResponse, webResponse: Re
} else {
const reader = body.getReader();
res.on('close', () => {
reader.cancel().catch((error: unknown) => {
// eslint-disable-next-line no-console
console.error('An unexpected error occurred in the middle of the stream.', error);
reader.cancel().catch(() => {
// Don't log here, or errors will get logged twice in most cases
});
});
while (true) {