-
Notifications
You must be signed in to change notification settings - Fork 30k
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: add argument information for socket.destroy() #7238
Conversation
@@ -512,14 +512,17 @@ If `true` - [`socket.connect(options[, connectListener])`][`socket.connect(optio | |||
haven't yet finished. Will be set to `false` before emitting `connect` event | |||
and/or calling [`socket.connect(options[, connectListener])`][`socket.connect(options, connectListener)`]'s callback. | |||
|
|||
### socket.destroy() | |||
### socket.destroy([exception]) |
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.
Two bits:
- What is the expected type of the argument
- Either
reason
orerror
would be better thanexception
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.
@jasnell I chose exception
because that's what it is called in the code. If we want to change it, do we have to reach into the code to change it there too?
I don't like error
for the document because then you have to explain that error
will be passed as an argument to any listeners on the 'error'
event, which can get confusing especially to new users. So I'd probably go with reason
over error
, but reason
doesn't signal to the reader that it's an error the way exception
does.
As for the type, it would seem to be expecting an Error
object but it actually doesn't look like there's any enforcement in the code so you could probably send it anything at all. I mean, it's just an argument for a listener, so it's kinda sorta up to the end user, I suppose. Suggest that it should (rather than must) be an Error
perhaps?
Related: #7137 |
@nodejs/documentation |
bump, especially on specifying the type. (See #7238 (comment) above. The code does not check for a type and any type could be useful in theory, at least. Or maybe |
Small doc improvement...review, anyone? @nodejs/collaborators |
LGTM |
2 similar comments
LGTM |
LGTM |
PR-URL: nodejs#7238 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Landed in 92adbe4 |
PR-URL: #7238 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
PR-URL: #7238 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Checklist
Affected core subsystem(s)
doc net
Description of change