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
base: master
from

Conversation

Projects
None yet
5 participants
@BridgeAR
Member

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 some commits Sep 28, 2017

stream: remove dead code
This condition could never be met because all calling functions
guarded against this.

@BridgeAR BridgeAR requested a review from mcollina Sep 28, 2017

@mcollina

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.

@mcollina

mcollina Sep 28, 2017

Member

I would keep this safety check in.

This comment has been minimized.

@BridgeAR

BridgeAR Sep 28, 2017

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.

@BridgeAR

BridgeAR Sep 28, 2017

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

BridgeAR Sep 29, 2017

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 Sep 29, 2017

Member

This can be removed then, 👍 .

@mcollina mcollina requested a review from jasnell Sep 28, 2017

@mcollina

This comment has been minimized.

Show comment
Hide comment
@mcollina
Member

mcollina commented Sep 28, 2017

@lpinca

lpinca approved these changes Sep 29, 2017

@BridgeAR

This comment has been minimized.

Show comment
Hide comment
@BridgeAR

This comment has been minimized.

Show comment
Hide comment
@BridgeAR

BridgeAR Oct 1, 2017

Member

Landed in 4536128 and db7d133

Member

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

stream: remove dead code
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

stream: migrate to internal/errors
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

stream: remove dead code
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

stream: migrate to internal/errors
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment