Skip to content

stream: use synchronous error validation & validate abort signal option - #41777

Merged
nodejs-github-bot merged 1 commit into
nodejs:masterfrom
iMoses:stream-sync-error-validations
Feb 3, 2022
Merged

stream: use synchronous error validation & validate abort signal option#41777
nodejs-github-bot merged 1 commit into
nodejs:masterfrom
iMoses:stream-sync-error-validations

Conversation

@iMoses

Copy link
Copy Markdown
Contributor

made sure top level methods aren't async/generators
so that validation errors could be caught synchronously
also added validation for the abort signal option

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/streams

@nodejs-github-botnodejs-github-bot added the needs-ci PRs that need a full CI run. label Jan 30, 2022
@iMoses
iMosesforce-pushed the stream-sync-error-validations branch from 49b4925 to 347b307CompareJanuary 30, 2022 18:41
Comment threadlib/internal/streams/operators.js Outdated

@benjamingrbenjamingr 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.

Left some comment about the difference between errors in generators/async functions in this API other than that looks good thanks 🙏

made sure top level methods aren't async/generators
so that validation errors could be caught synchronously
also added validation for the abort signal option
@iMoses
iMosesforce-pushed the stream-sync-error-validations branch from 347b307 to 2e4f992CompareJanuary 31, 2022 15:08

@benjamingrbenjamingr 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.

Generally looks good 🙇

Requesting CI: but I suspect it won't pass and there will be a few lint errors but I want to see the tests themselves passing :)

@benjamingrbenjamingr added the request-ci Add this label to start a Jenkins CI on a PR. label Jan 31, 2022
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jan 31, 2022
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Comment on lines +192 to +194
if (options?.signal != null) {
validateAbortSignal(options.signal, 'options.signal');
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This can be simplified to validateAbortSignal(options?.signal, 'options.signal') (also in other places)

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

good to know 👍

Comment on lines +124 to +125
assert.rejects(() => Readable.from([]).reduce((x, y) => x + y, 0, 1), /ERR_INVALID_ARG_TYPE/);
assert.rejects(() => Readable.from([]).reduce((x, y) => x + y, 0, { signal: true }), /ERR_INVALID_ARG_TYPE/);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

these two should probably have .then(common.mustCall()) (e.g. like you did in test-stream-some-every)

@LinkgoronLinkgoronFeb 3, 2022

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You can also add it to the two lines above them (that you didn't add).

@benjamingrbenjamingr added the commit-queue Add this label to land a pull request using GitHub Actions. label Feb 3, 2022
@nodejs-github-botnodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Feb 3, 2022
@nodejs-github-bot
nodejs-github-bot merged commit 06625ff into nodejs:masterFeb 3, 2022
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Landed in 06625ff

@iMoses

Copy link
Copy Markdown
ContributorAuthor

@Linkgoron would you like me to take care of your notes in a future PR?

ruyadorno pushed a commit that referenced this pull request Feb 8, 2022
made sure top level methods aren't async/generators
so that validation errors could be caught synchronously
also added validation for the abort signal option
PR-URL: #41777
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Nitzan Uziely <linkgoron@gmail.com>
@ruyadornoruyadorno mentioned this pull request Feb 8, 2022
@danielleadams

This comment was marked as outdated.

@danielleadamsdanielleadams added the semver-minor PRs that contain new features and should be released in the next minor version. label Feb 28, 2022
@danielleadamsdanielleadams added backport-blocked-v16.x and removed semver-minor PRs that contain new features and should be released in the next minor version. labels Mar 2, 2022
targos pushed a commit that referenced this pull request Jul 12, 2022
made sure top level methods aren't async/generators
so that validation errors could be caught synchronously
also added validation for the abort signal option
PR-URL: #41777
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Nitzan Uziely <linkgoron@gmail.com>
targos pushed a commit that referenced this pull request Jul 31, 2022
made sure top level methods aren't async/generators
so that validation errors could be caught synchronously
also added validation for the abort signal option
PR-URL: #41777
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Nitzan Uziely <linkgoron@gmail.com>
@targostargos mentioned this pull request Aug 3, 2022
guangwong pushed a commit to noslate-project/node that referenced this pull request Oct 10, 2022
made sure top level methods aren't async/generators
so that validation errors could be caught synchronously
also added validation for the abort signal option
PR-URL: nodejs/node#41777
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Nitzan Uziely <linkgoron@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ciPRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@iMoses@nodejs-github-bot@danielleadams@Linkgoron@benjamingr@targos