-
-
Notifications
You must be signed in to change notification settings - Fork 33.1k
Closed
Labels
discussIssues opened for discussions and feedbacks.Issues opened for discussions and feedbacks.netIssues and PRs related to the net subsystem.Issues and PRs related to the net subsystem.
Description
net.connect() - no args does ECONNREFUSED but should be invalid usage
I think I commented on this, and fixed it in backports, and it was thought
that net.connect() should be same as net.connect({port:undefined}), but I
don't agree, it never makes sense to connect when you don't say what you are
connecting to, it has no use case. also strange that undefined works like no
args were passed, but null is like {port: null} was passed. This all
seems ugly and messy. Check the tests.
For the quote above outlined in #33715 (comment), two solutions come to mind.
- Throw
ERR_MISSING_ARGS
when no arguments are passed (as suggested above -- invalid usage). - To fix the difference in behavior between
port: undefined
andport: null
, either makeport
a mandatory field that throwsERR_INVALID_ARGS
for anything other than string or numeric values or don't throwERR_INVALID_ARGS
forport: null
. This needs more brainstorming.
I'd appreciate a few pointers here to see where this should be going.
cc @sam-github
Metadata
Metadata
Assignees
Labels
discussIssues opened for discussions and feedbacks.Issues opened for discussions and feedbacks.netIssues and PRs related to the net subsystem.Issues and PRs related to the net subsystem.