Skip to content

net: add localAddress/Port for better error msgs - #3946

Closed
jscissr wants to merge 4 commits into
nodejs:masterfrom
jscissr:patch-2
Closed

net: add localAddress/Port for better error msgs#3946
jscissr wants to merge 4 commits into
nodejs:masterfrom
jscissr:patch-2

Conversation

@jscissr

Copy link
Copy Markdown
Contributor

That could result in an error being thrown while creating an error...

@mscdexmscdex added the net Issues and PRs related to the net subsystem. label Nov 20, 2015
@jasnell

Copy link
Copy Markdown
Member

how odd that this wasn't caught before. LGTM but it would be helpful to have a quick test case included that fails before this is fix but works after.

@evanlucas

Copy link
Copy Markdown
Contributor

Yea, apologies on that...not sure how that was missed :/

LGTM

@jscissr

Copy link
Copy Markdown
ContributorAuthor

I'll try making a test

@jasnell

Copy link
Copy Markdown
Member

It's not critical, just helpful. :) thank you!
On Nov 20, 2015 4:50 PM, "Jan Schär" notifications@github.com wrote:

I'll try making a test


Reply to this email directly or view it on GitHub
#3946 (comment).

@jscissr

Copy link
Copy Markdown
ContributorAuthor

Hmm, it looks like req.localAddress and req.localPort isn't even set anywhere, so the if block will never execute...
Should I add them after https://github.com/jscissr/node/blob/patch-2/lib/net.js#L819 ?

At least it means the worst that can happen is that you don't get a nice error message in the onerror event.

The code generating the errror messages was already there, but it could
never execute because these properties were not set.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I'm not sure which port to use here, it simply should produce an ECONNREFUSED error when connecting.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

mind making these const instead of var?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I copied that from another test. Should I make a PR that changes this for every test where it isn't already the new way?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I believe the plan is to update them as we go. But in general, all new tests should use const wherever possible

@cjihrig

Copy link
Copy Markdown
Contributor

LGTM pending comments and CI

@jscissrjscissr changed the title net: variable ex used before definednet: add localAddress/Port for better error msgsNov 23, 2015
@evanlucas

Copy link
Copy Markdown
Contributor

CI: https://ci.nodejs.org/job/node-test-pull-request/816/

LGTM if CI is happy

@jscissr

Copy link
Copy Markdown
ContributorAuthor

It looks like something was wrong with the CI server. Can you restart it @evanlucas?

@evanlucas

Copy link
Copy Markdown
Contributor

evanlucas pushed a commit that referenced this pull request Nov 24, 2015
Adds localAddress and localPort to req so we have better error messages.
Also fixes a case where ex is used before it is declared.
PR-URL: #3946
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
@evanlucas

Copy link
Copy Markdown
Contributor

Landed in d7b199d. I went ahead and squashed the commits into 1 also. Thanks!

@jscissr
jscissr deleted the patch-2 branch November 25, 2015 21:02
MylesBorins pushed a commit that referenced this pull request Dec 1, 2015
Adds localAddress and localPort to req so we have better error messages.
Also fixes a case where ex is used before it is declared.
PR-URL: #3946
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
rvagg pushed a commit that referenced this pull request Dec 4, 2015
Adds localAddress and localPort to req so we have better error messages.
Also fixes a case where ex is used before it is declared.
PR-URL: #3946
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
rvagg pushed a commit that referenced this pull request Dec 5, 2015
Adds localAddress and localPort to req so we have better error messages.
Also fixes a case where ex is used before it is declared.
PR-URL: #3946
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
@jasnelljasnell mentioned this pull request Dec 17, 2015
jasnell pushed a commit that referenced this pull request Dec 17, 2015
Adds localAddress and localPort to req so we have better error messages.
Also fixes a case where ex is used before it is declared.
PR-URL: #3946
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
jasnell pushed a commit that referenced this pull request Dec 23, 2015
Adds localAddress and localPort to req so we have better error messages.
Also fixes a case where ex is used before it is declared.
PR-URL: #3946
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

netIssues and PRs related to the net subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@jscissr@jasnell@evanlucas@cjihrig@mscdex@MylesBorins