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

doc: update promisify() docs with behavior when bad arguments are passed #17593

Closed
wants to merge 3 commits into from

Conversation

ramsgoli
Copy link
Contributor

Currently the documentation states that promisify() will result in
undefined behavior if bad arguments are passed. This is not necessarily
the case, since the behavior is well defined, but just not useful.

Fixes: #17569

Checklist
Affected core subsystem(s)

doc

@nodejs-github-bot nodejs-github-bot added doc Issues and PRs related to the documentations. util Issues and PRs related to the built-in util module. labels Dec 10, 2017
@ramsgoli ramsgoli changed the title Update promisify() docs with behavior when bad arguments are passed doc: update promisify() docs with behavior when bad arguments are passed Dec 10, 2017
Copy link
Member

@apapirovski apapirovski left a comment

Choose a reason for hiding this comment

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

SGTM — very concise. Just have a few nits below.

doc/api/util.md Outdated
behavior if it does not.
final argument in all cases. If `original` is not a function, `promisify()`
will throw an error. If `original` is a function but its last argument is not a
node-style callback, it will be still be passed a node-style callback as its last
Copy link
Member

Choose a reason for hiding this comment

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

I think we tend to refer to these as "Node.js style callback".

doc/api/util.md Outdated
final argument in all cases. If `original` is not a function, `promisify()`
will throw an error. If `original` is a function but its last argument is not a
node-style callback, it will be still be passed a node-style callback as its last
argument anyways.
Copy link
Member

Choose a reason for hiding this comment

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

the "anyways" shouldn't be necessary here.

doc/api/util.md Outdated
behavior if it does not.
final argument in all cases. If `original` is not a function, `promisify()`
will throw an error. If `original` is a function but its last argument is not a
Node.js style callback, it will be still be passed a Node.js style callback as its last
Copy link
Member

Choose a reason for hiding this comment

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

If you or someone else would like a good second pull request after this one lands, I'd be all for getting rid of the awkward and non-obvious Node.js style callback terminology here and in errors.md and replacing it with error-first callback which is more informative, less awkward, and probably more in line with usage outside of our docs.

Copy link
Member

Choose a reason for hiding this comment

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

Nit: long line, please add a line break at 80 chars. Also there seems to be a redundant "be"?

Copy link
Member

@Trott Trott left a comment

Choose a reason for hiding this comment

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

Looks good to me! Thanks for the pull request!

Copy link
Member

@benjamingr benjamingr left a comment

Choose a reason for hiding this comment

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

Thank you for doing this :)

@maclover7
Copy link
Contributor

doc/api/util.md Outdated
behavior if it does not.
final argument in all cases. If `original` is not a function, `promisify()`
will throw an error. If `original` is a function but its last argument is not a
Node.js style callback, it will be still be passed a Node.js style callback as its last
Copy link
Member

Choose a reason for hiding this comment

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

Nit: long line, please add a line break at 80 chars. Also there seems to be a redundant "be"?

Currently the documentation states that promisify() will result in
undefined behavior if bad arguments are passed. This is not necessarily
the case, since the behavior is well defined, but just not useful.

Fixes: nodejs#17569 (comment)
@ramsgoli
Copy link
Contributor Author

@lpinca whoops, my bad! just noticed those details. Thanks for pointing them out! 👍

@apapirovski apapirovski added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Dec 12, 2017
@apapirovski
Copy link
Member

BridgeAR pushed a commit to BridgeAR/node that referenced this pull request Dec 12, 2017
Currently the documentation states that promisify() will result in
undefined behavior if bad arguments are passed. This is not
necessarily the case, since the behavior is well defined, but just
not useful.

PR-URL: nodejs#17593
Fixes: nodejs#17569
Reviewed-By: Anatoli Papirovski <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Jon Moss <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
@BridgeAR
Copy link
Member

Landed in 031d01b

@BridgeAR BridgeAR closed this Dec 12, 2017
@BridgeAR
Copy link
Member

@ramsgoli just as a note - I fixed the commit message as it did not comply to our guidelines (that you ticket off while opening the PR). The commit message and the general line length was to long.

@ramsgoli
Copy link
Contributor Author

@BridgeAR ah, thank you so much for the reminder! I need to be sure to pay attention to all the details of the guidelines next time. Thanks again 🙌

@BridgeAR
Copy link
Member

Sure thing. I just thought it is best to provide a short feedback so I have less work when landing your next PR 😄

@addaleax addaleax removed the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Dec 13, 2017
ramsgoli added a commit to ramsgoli/node that referenced this pull request Dec 13, 2017
We change the awkward "Node.js style callback" phrasing to the
more informative "error-first style callback," which is more
in line with its usage

Refs: nodejs#17593 (comment)
MylesBorins pushed a commit that referenced this pull request Jan 8, 2018
Currently the documentation states that promisify() will result in
undefined behavior if bad arguments are passed. This is not
necessarily the case, since the behavior is well defined, but just
not useful.

PR-URL: #17593
Fixes: #17569
Reviewed-By: Anatoli Papirovski <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Jon Moss <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
@MylesBorins MylesBorins mentioned this pull request Jan 10, 2018
MylesBorins pushed a commit that referenced this pull request Jan 22, 2018
Currently the documentation states that promisify() will result in
undefined behavior if bad arguments are passed. This is not
necessarily the case, since the behavior is well defined, but just
not useful.

PR-URL: #17593
Fixes: #17569
Reviewed-By: Anatoli Papirovski <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Jon Moss <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Issues and PRs related to the documentations. util Issues and PRs related to the built-in util module.
Projects
None yet
Development

Successfully merging this pull request may close these issues.