Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stream: migrate stream errors to internal/errors #15665

Closed
wants to merge 2 commits into from

Conversation

BridgeAR
Copy link
Member

I removed some dead code and migrated the rest of the stream errors.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

stream

This condition could never be met because all calling functions
guarded against this.
@BridgeAR BridgeAR added errors Issues and PRs related to JavaScript errors originated in Node.js core. stream Issues and PRs related to the stream subsystem. labels Sep 28, 2017
@nodejs-github-bot nodejs-github-bot added the stream Issues and PRs related to the stream subsystem. label Sep 28, 2017
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

// If we get here before consuming all the bytes, then that is a
// bug in node. Should never happen.
if (state.length > 0)
throw new Error('"endReadable()" called on non-empty stream');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would keep this safety check in.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is dead code at the moment. There is no way to trigger it right now and only a false refactoring could trigger this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just as reference - there are three occurrences of endReadable right now. Each of those are only triggered in case state.length === 0. Those guards are here
https://github.com/BridgeAR/node/blob/615ab68c02e81bc17dbfb15d489a3558f667dc67/lib/_stream_readable.js#L384
https://github.com/BridgeAR/node/blob/615ab68c02e81bc17dbfb15d489a3558f667dc67/lib/_stream_readable.js#L395
https://github.com/BridgeAR/node/blob/615ab68c02e81bc17dbfb15d489a3558f667dc67/lib/_stream_readable.js#L466
The function can also not be triggered from the outside.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be removed then, 👍 .

@mcollina
Copy link
Member

cc @nodejs/streams

@BridgeAR BridgeAR added the semver-major PRs that contain breaking changes and should be released in the next major version. label Sep 29, 2017
@BridgeAR
Copy link
Member Author

BridgeAR commented Oct 1, 2017

@BridgeAR
Copy link
Member Author

BridgeAR commented Oct 1, 2017

Landed in 4536128 and db7d133

@BridgeAR BridgeAR closed this Oct 1, 2017
BridgeAR added a commit to BridgeAR/node that referenced this pull request Oct 1, 2017
This condition could never be met because all calling functions
guarded against this.

PR-URL: nodejs#15665
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
BridgeAR added a commit to BridgeAR/node that referenced this pull request Oct 1, 2017
PR-URL: nodejs#15665
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
addaleax pushed a commit to addaleax/ayo that referenced this pull request Oct 4, 2017
This condition could never be met because all calling functions
guarded against this.

PR-URL: nodejs/node#15665
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
addaleax pushed a commit to addaleax/ayo that referenced this pull request Oct 4, 2017
PR-URL: nodejs/node#15665
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@BridgeAR BridgeAR deleted the migrate-stream-errors branch April 1, 2019 23:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
errors Issues and PRs related to JavaScript errors originated in Node.js core. semver-major PRs that contain breaking changes and should be released in the next major version. stream Issues and PRs related to the stream subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants