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

@BridgeAR BridgeAR commented Sep 28, 2017

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

BridgeAR added 2 commits Sep 28, 2017
This condition could never be met because all calling functions
guarded against this.
@BridgeAR BridgeAR requested a review from mcollina Sep 28, 2017
Copy link
Member

@mcollina mcollina left a comment

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');

This comment has been minimized.

@mcollina

mcollina Sep 28, 2017
Member

I would keep this safety check in.

This comment has been minimized.

@BridgeAR

BridgeAR Sep 28, 2017
Author Member

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

This comment has been minimized.

@BridgeAR

BridgeAR Sep 29, 2017
Author Member

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.

This comment has been minimized.

@mcollina

mcollina Sep 29, 2017
Member

This can be removed then, 👍 .

@mcollina mcollina requested a review from jasnell Sep 28, 2017
@mcollina
Copy link
Member

@mcollina mcollina commented Sep 28, 2017

@lpinca
lpinca approved these changes Sep 29, 2017
@BridgeAR
Copy link
Member Author

@BridgeAR 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 added 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 added 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 BridgeAR:migrate-stream-errors branch Apr 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants
You can’t perform that action at this time.