-
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
net: add localAddress/Port for better error msgs #3946
Conversation
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. |
Yea, apologies on that...not sure how that was missed :/ LGTM |
I'll try making a test |
It's not critical, just helpful. :) thank you!
|
Hmm, it looks like 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.
var net = require('net'); | ||
|
||
var client = net.connect({ | ||
port: common.PORT + 1, |
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.
I'm not sure which port to use here, it simply should produce an ECONNREFUSED error when connecting.
As suggested by @evanlucas
@@ -0,0 +1,21 @@ | |||
'use strict'; | |||
var common = require('../common'); |
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.
mind making these const
instead of var?
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.
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?
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.
I believe the plan is to update them as we go. But in general, all new tests should use const wherever possible
LGTM pending comments and CI |
As suggested by @evanlucas and @cjihrig
CI: https://ci.nodejs.org/job/node-test-pull-request/816/ LGTM if CI is happy |
It looks like something was wrong with the CI server. Can you restart it @evanlucas? |
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>
Landed in d7b199d. I went ahead and squashed the commits into 1 also. Thanks! |
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>
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>
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>
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>
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>
That could result in an error being thrown while creating an error...