-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
Conversation
There was a problem hiding this 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 |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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"?
There was a problem hiding this 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!
There was a problem hiding this 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 :)
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 |
There was a problem hiding this comment.
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)
dee6aba
to
e215574
Compare
@lpinca whoops, my bad! just noticed those details. Thanks for pointing them out! 👍 |
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]>
Landed in 031d01b |
@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. |
@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 🙌 |
Sure thing. I just thought it is best to provide a short feedback so I have less work when landing your next PR 😄 |
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)
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]>
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]>
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