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: add argument information for socket.destroy() #7238

Closed
wants to merge 1 commit into from

Conversation

Trott
Copy link
Member

@Trott Trott commented Jun 8, 2016

Checklist
  • documentation is changed or added
  • the commit message follows commit guidelines
Affected core subsystem(s)

doc net

Description of change

@Trott Trott added doc Issues and PRs related to the documentations. net Issues and PRs related to the net subsystem. labels Jun 8, 2016
@@ -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])
Copy link
Member

Choose a reason for hiding this comment

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

Two bits:

  1. What is the expected type of the argument
  2. Either reason or error would be better than exception

Copy link
Member Author

@Trott Trott Jun 13, 2016

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?

@jasnell
Copy link
Member

jasnell commented Jun 9, 2016

Related: #7137

@Trott
Copy link
Member Author

Trott commented Jun 14, 2016

@nodejs/documentation

@Trott
Copy link
Member Author

Trott commented Jun 20, 2016

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 Error makes the most sense, in practice?)

@Trott
Copy link
Member Author

Trott commented Jun 21, 2016

Small doc improvement...review, anyone? @nodejs/collaborators

@cjihrig
Copy link
Contributor

cjihrig commented Jun 21, 2016

LGTM

2 similar comments
@indutny
Copy link
Member

indutny commented Jun 21, 2016

LGTM

@jbergstroem
Copy link
Member

LGTM

Trott added a commit to Trott/io.js that referenced this pull request Jun 22, 2016
PR-URL: nodejs#7238
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Fedor Indutny <[email protected]>
Reviewed-By: Johan Bergström <[email protected]>
@Trott
Copy link
Member Author

Trott commented Jun 22, 2016

Landed in 92adbe4

@Trott Trott closed this Jun 22, 2016
Fishrock123 pushed a commit that referenced this pull request Jun 27, 2016
PR-URL: #7238
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Fedor Indutny <[email protected]>
Reviewed-By: Johan Bergström <[email protected]>
@Fishrock123 Fishrock123 mentioned this pull request Jun 27, 2016
Fishrock123 pushed a commit that referenced this pull request Jul 5, 2016
PR-URL: #7238
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Fedor Indutny <[email protected]>
Reviewed-By: Johan Bergström <[email protected]>
@Fishrock123 Fishrock123 mentioned this pull request Jul 5, 2016
@Trott Trott deleted the exception branch January 13, 2022 22:43
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. net Issues and PRs related to the net subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants