Skip to content

refactor: simplify completion handling with stream.finished - #114

Open
Phillip9587 wants to merge 5 commits into
v3from
experiment/finished-only-errors
Open

Phillip9587 wants to merge 5 commits into
v3from
experiment/finished-only-errors

Conversation

@Phillip9587

Copy link
Copy Markdown
Contributor

I was curious if the tests would pass after removing all the manual socket and event listener handling, and they do. This lets stream.finished() handle completion and listener cleanup. Original transport errors are recovered from stream.errored (https://nodejs.org/download/release/v18.0.0/docs/api/stream.html#readableerrored), while premature-close errors and generated HTTP/1 abort errors remain suppressed when there is no stored transport error. I decided to preserve the existing abort behavior because passing those generated errors to the callback would be a breaking change.

Added tests confirming that real ECONNRESET errors still reach the callback exactly once.

@Phillip9587

Copy link
Copy Markdown
Contributor Author

legacy tests are failing because stream.errored is only supported on Node.js >=18

This comment was marked as outdated.

This comment was marked as outdated.

This comment was marked as outdated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants