Skip to content

streams: add null check in Readable.from#32873

Closed
rexagod wants to merge 1 commit into
nodejs:masterfrom
rexagod:i-32845
Closed

streams: add null check in Readable.from#32873
rexagod wants to merge 1 commit into
nodejs:masterfrom
rexagod:i-32845

Conversation

@rexagod

@rexagod rexagod commented Apr 16, 2020

Copy link
Copy Markdown
Member

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

@himself65 himself65 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Test needed

Comment thread lib/internal/streams/from.js Outdated
Comment thread lib/internal/streams/from.js Outdated
Comment thread test/parallel/test-stream-readable-next-no-null.js
@rexagod

rexagod commented Apr 26, 2020

Copy link
Copy Markdown
Member Author

ping @addaleax @himself65

@addaleax

Copy link
Copy Markdown
Member

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

Comment thread lib/internal/streams/from.js Outdated
} else {
reading = false;
const res = await value;
if (res == null) throw new ERR_STREAM_NULL_VALUES();

Copy link
Copy Markdown
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

ronag commented Apr 27, 2020

Copy link
Copy Markdown
Member

@nodejs/streams

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

no changes request

Comment thread doc/api/stream.md Outdated
Comment thread lib/internal/streams/from.js
Comment thread lib/internal/streams/from.js Outdated
@ronag

ronag commented Apr 27, 2020

Copy link
Copy Markdown
Member

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

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

Comment thread lib/internal/streams/from.js
Comment thread lib/internal/streams/from.js
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Comment thread lib/internal/streams/from.js
Comment thread lib/internal/streams/from.js Outdated
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
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
Copy Markdown
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