-
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: incorrect readline.question promisify example #38039
Labels
doc
Issues and PRs related to the documentations.
Comments
From the utils docs
In the case, Line 418 in 1bead01
therefore, the custom will be used here. IMO, the example in question is valid. |
This was referenced Jun 8, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
📗 API Reference Docs Problem
Version: 15.13.0
Platform: Windows 10 x64
Subsystem: readline
Location
Section of the site where the content exists
Affected URL(s):
Description
Concise explanation of the problem
Here is a suggested code sample from docs that should allow to use
question
method with Promise-based API:The problem with code above is that it will go into catch section on user input. Cause of this is that
question
method callback accept user answer as first parameter which conflict with node-style callback convention used byutil.promisify
.So
readline.question
can't be used alongside withutil.promisify
. I see two possible solutions: a) remove this section from docs or b) provide code snippet that shows how to correctly wrap this method with Promise. If you interested in correct code snippet I can work on draft.submit a pull request.
The text was updated successfully, but these errors were encountered: