Skip to content

net: handle net.connect() without arguments

  • lib: handle one of args case in ERR_MISSING_ARGS

    This makes ERR_MISSING_ARGS handle nested arrays in argument names as one-of case and will print them as '"arg1" or "arg2" or "arg3"'. Example:

throw new ERR_MISSING_ARGS(['a', 'b', 'c']);
// will result in message:
// The "a" or "b" or "c" argument must be specified
  • net: check args in net.connect() call

    Previously Node.js would handle empty net.connect() call as if the user passed empty options object which doesn't really make sense. This was due to the fact that it uses the same normalizeArgs function as .listen() call where such call is perfectly fine. This will make it clear what is the problem with such call and how it can be resolved. It now throws ERR_MISSING_ARGS if no arguments were passed or neither path nor port is specified.

    Fixes: #33930 (closed)

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

/cc @nodejs/net

Merge request reports

Loading