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

@rexagodrexagod 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

@himself65himself65 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 threadlib/internal/streams/from.js Outdated
Comment threadlib/internal/streams/from.js Outdated
himself65
himself65 previously requested changes Apr 17, 2020
Comment threadtest/parallel/test-stream-readable-next-no-null.js
@rexagod

Copy link
Copy Markdown
MemberAuthor

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 threadlib/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

Copy link
Copy Markdown
Member

@nodejs/streams

@ronagronag added the stream Issues and PRs related to the stream subsystem. label Apr 27, 2020
Comment threadlib/internal/streams/from.js Outdated
Comment threadlib/internal/streams/from.js
@himself65
himself65 dismissed their stale reviewApril 27, 2020 09:30

no changes request

Comment threaddoc/api/stream.md Outdated
Comment threadlib/internal/streams/from.js
Comment threadlib/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).

@mcollinamcollina 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 threadlib/internal/streams/from.js
Comment threadlib/internal/streams/from.js
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

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

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@ronagronag added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Apr 27, 2020
@addaleaxaddaleax 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

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>
@targostargos 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>
@targostargos mentioned this pull request May 7, 2020
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 freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

streamIssues 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

@rexagod@addaleax@ronag@nodejs-github-bot@mcollina@BridgeAR@himself65