Skip to content

Commit

Permalink
fix(errors): Remove duplicate logging of errors (#10197)
Browse files Browse the repository at this point in the history
* fix(errors): Remove duplicate logging of errors

* chore: changeset
  • Loading branch information
Princesseuh authored Feb 22, 2024
1 parent 598f30c commit c856c72
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/light-masks-watch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"astro": patch
---

Fixes errors being logged twice in some cases
5 changes: 2 additions & 3 deletions packages/astro/src/vite-plugin-astro-server/response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit c856c72

Please sign in to comment.