Skip to content

doc: mention errors thrown by methods called on an unbound dgram.Socket - #33983

Closed
mkrawczuk wants to merge 3 commits into
nodejs:masterfrom
mkrawczuk:dgram_error_doc
Closed

doc: mention errors thrown by methods called on an unbound dgram.Socket#33983
mkrawczuk wants to merge 3 commits into
nodejs:masterfrom
mkrawczuk:dgram_error_doc

Conversation

@mkrawczuk

Copy link
Copy Markdown
Contributor

While working on this I have discovered an inconsistency: given dgram.Socket instance is undbound, calling address() on it results in a system error EBADF being thrown, while calling remoteAddress() results in ERR_SOCKET_DGRAM_NOT_CONNECTED.

Also, calling send() on an unbound socket throws ERR_SOCKET_BAD_PORT which might also be found misguiding.

These I believe are easy fixes. Once the documentation resembles the current state of things I can open another PR introducing a fix to it.

Also mentioned a side effect caused by socket.addMembership() and socket.addSourceSpecificMembership(). Not sure if it is desired.

@nodejs-github-botnodejs-github-bot added dgram Issues and PRs related to the dgram subsystem / UDP. doc Issues and PRs related to the documentations. labels Jun 20, 2020

@addaleaxaddaleax left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I agree, the error system is very inconsistent here, unfortunately … 😕 Thanks for the PR!

Comment threaddoc/api/dgram.md Outdated
Comment threaddoc/api/dgram.md Outdated
Comment threaddoc/api/dgram.md Outdated
Comment threaddoc/api/dgram.md Outdated
@Trott

Copy link
Copy Markdown
Member

The text is fine as is, but if you want to fine-tune it even more, here's one more optional suggestion: Instead of it, I think this method would have been a little better? So "...this method will implicitly bind..." and "This method throws EWHATEVER..." and so forth.

@TrottTrott added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jun 20, 2020
@mkrawczuk

Copy link
Copy Markdown
ContributorAuthor

Yeah, let's not be satisfied with 99% correct if we can be 100% correct with almost no effort.

Comment threaddoc/api/dgram.md
Trott pushed a commit that referenced this pull request Jun 24, 2020
PR-URL: #33983
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@Trott

Copy link
Copy Markdown
Member

Landed in 91d9cdf

@TrottTrott closed this Jun 24, 2020
MylesBorins pushed a commit that referenced this pull request Jul 14, 2020
PR-URL: #33983
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@MylesBorinsMylesBorins mentioned this pull request Jul 14, 2020
MylesBorins pushed a commit that referenced this pull request Jul 16, 2020
PR-URL: #33983
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
addaleax pushed a commit that referenced this pull request Sep 22, 2020
PR-URL: #33983
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@codebyterecodebytere mentioned this pull request Sep 28, 2020
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.dgramIssues and PRs related to the dgram subsystem / UDP.docIssues and PRs related to the documentations.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@mkrawczuk@Trott@jasnell@addaleax@trivikr@nodejs-github-bot