-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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: check and throw on error for getsockname #12871
Conversation
Does this have |
// TODO(bnoordhuis) Check err and throw? | ||
var err = this._handle.getsockname(out); | ||
if (err) { | ||
throw errnoException(err, 'address'); |
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.
maybe
if (err) {
self.emit('error', errnoException(err, 'address'));
return;
}
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.
@addaleax won't throwing make this semver-major
?
Ohh just saw you marked it.
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.
Yeah, that’s why I’ve labelled it as a major. ;) But emitting an error event a) would be semver-major too and b) doesn’t really make sense here, it’s a fully synchronous call.
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.
Ok. I agree.
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.
Anyway need to add a test for this.
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.
Looks good, but I am afraid you might need to tweak the error regexp in the test a bit more to work cross-platform ;)
I guess I'll find out shortly about that 😄 |
@danbev Windows error is |
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 the benefits outweigh the cons on this one. I feel like this is a subtle change that could take down processes. I'm leaning towards -1 on this.
@evanlucas Going through the errors that
These would point to a bug in Node, I say throwing an error is okay.
These won’t happen/also would point to a serious bug in Node. Should definitely make some noise.
Again, this probably never happens. Also, throwing seems better than returning invalid data here. → I think it’s safe to do this. |
The subsystem in the commit message should be |
Thanks, updated now and I'll give CI another go. |
This commit attempts fix a TODO in net.js: TODO(bnoordhuis) Check err and throw?
Ah, let me fix that. thanks |
4a17e17
to
1d1bd12
Compare
@evanlucas Just wanted to ask if you are still leaning towards a -1 on this? |
@evanlucas Great, thanks! |
This commit attempts fix a TODO in net.js: TODO(bnoordhuis) Check err and throw? PR-URL: nodejs#12871 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
Landed in cf980b0 |
This commit attempts fix a TODO in net.js: TODO(bnoordhuis) Check err and throw? PR-URL: nodejs#12871 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
This commit attempts fix a TODO in net.js:
TODO(bnoordhuis) Check err and throw?
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
lib