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

streams: add null check in Readable.from #32873

Closed
wants to merge 1 commit into from

Conversation

rexagod
Copy link
Member

@rexagod rexagod commented Apr 16, 2020

Throws ERR_STREAM_NULL_VALUES error if a null value is passed to
Readable.from. Also added docs for the same.

Fixes: #32845

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests added
  • documentation is changed or added
  • commit message follows commit guidelines

Copy link
Member

@himself65 himself65 left a comment

Choose a reason for hiding this comment

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

Test needed

test/parallel/test-stream-readable-next-no-null.js Outdated Show resolved Hide resolved
@rexagod
Copy link
Member Author

rexagod commented Apr 26, 2020

ping @addaleax @himself65

@addaleax
Copy link
Member

@rexagod This LGTM but it looks like this needs to be rebased against master to resolve merge conflicts.

} else {
reading = false;
const res = await value;
if (res == null) throw new ERR_STREAM_NULL_VALUES();
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure I agree with this throwing. There is no way to catch this? I think it should do readable.destroy(new ERR_STREAM_NULL_VALUES()). @lpinca Thoughts?

@ronag
Copy link
Member

ronag commented Apr 27, 2020

@nodejs/streams

@ronag ronag added the stream Issues and PRs related to the stream subsystem. label Apr 27, 2020
lib/internal/streams/from.js Outdated Show resolved Hide resolved
@himself65 himself65 dismissed their stale review April 27, 2020 09:30

no changes request

doc/api/stream.md Outdated Show resolved Hide resolved
lib/internal/streams/from.js Outdated Show resolved Hide resolved
@ronag
Copy link
Member

ronag commented Apr 27, 2020

I would like @lpinca's feedback here on whether we throw err or destroy(err).

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

@nodejs-github-bot
Copy link
Collaborator

lib/internal/streams/from.js Outdated Show resolved Hide resolved
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@ronag ronag added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Apr 27, 2020
@addaleax addaleax removed the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Apr 27, 2020
@addaleax
Copy link
Member

@rexagod Looks like a merge commit somehow got in here, can you rebase this against master?

Throws `ERR_STREAM_NULL_VALUES` error if a null value is passed to
`Readable.from`. Also added docs for the same.

Fixes: nodejs#32845

resolve recieved value and add test

Update test/parallel/test-stream-readable-next-no-null.js

Co-Authored-By: 扩散性百万甜面包 <himself65@outlook.com>

rebase fix

fixup

fixup: destroy -> throw
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

mcollina pushed a commit that referenced this pull request Apr 29, 2020
Throws `ERR_STREAM_NULL_VALUES` error if a null value is passed to
`Readable.from`. Also added docs for the same.

Co-Authored-By: 扩散性百万甜面包 <himself65@outlook.com>
Fixes: #32845
PR-URL: #32873
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
@mcollina
Copy link
Member

Landed in 2cd7970

@mcollina mcollina closed this Apr 29, 2020
targos pushed a commit that referenced this pull request May 4, 2020
Throws `ERR_STREAM_NULL_VALUES` error if a null value is passed to
`Readable.from`. Also added docs for the same.

Co-Authored-By: 扩散性百万甜面包 <himself65@outlook.com>
Fixes: #32845
PR-URL: #32873
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
@targos targos mentioned this pull request May 4, 2020
targos pushed a commit that referenced this pull request May 7, 2020
Throws `ERR_STREAM_NULL_VALUES` error if a null value is passed to
`Readable.from`. Also added docs for the same.

Co-Authored-By: 扩散性百万甜面包 <himself65@outlook.com>
Fixes: #32845
PR-URL: #32873
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
targos pushed a commit that referenced this pull request May 13, 2020
Throws `ERR_STREAM_NULL_VALUES` error if a null value is passed to
`Readable.from`. Also added docs for the same.

Co-Authored-By: 扩散性百万甜面包 <himself65@outlook.com>
Fixes: #32845
PR-URL: #32873
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stream Issues and PRs related to the stream subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

stream: Readable.from with null
7 participants