stream: migrate stream errors to internal/errors#15665
stream: migrate stream errors to internal/errors#15665BridgeAR wants to merge 2 commits intonodejs:masterfrom
Conversation
This condition could never be met because all calling functions guarded against this.
| // 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'); |
There was a problem hiding this comment.
I would keep this safety check in.
There was a problem hiding this comment.
It is dead code at the moment. There is no way to trigger it right now and only a false refactoring could trigger this.
There was a problem hiding this comment.
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.
|
cc @nodejs/streams |
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>
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>
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>
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>
I removed some dead code and migrated the rest of the stream errors.
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
stream