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: fix net.Server.prototype.listen error message #11693

Closed
wants to merge 2 commits into
base: master
from

Conversation

Projects
None yet
6 participants
@joyeecheung
Member

joyeecheung commented Mar 5, 2017

The first commit uses util.inspect to make the error messages thrown by server.listen more useful.

Before:

net.createServer().listen(null)
// Error: Invalid listen argument: [object Object]

After:

net.createServer().listen(null)
// Error: Invalid listen argument: { port: null }

The second commit refactors the listen option test, adding precise error message validation and a few more test cases.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

net, test

@joyeecheung joyeecheung added the test label Mar 5, 2017

@mscdex mscdex added semver-major test and removed test labels Mar 5, 2017

Show outdated Hide outdated test/parallel/test-net-server-listen-options.js
assert.throws(() => listen(65536, common.mustNotCall()), portError);
assert.throws(() => listen(1 / 0, common.mustNotCall()), portError);
assert.throws(() => listen(-1 / 0, common.mustNotCall()), portError);
assert.throws(() => listen(-1 / 0, common.mustNotCall()), portError);

This comment has been minimized.

@lpinca

lpinca Mar 5, 2017

Member

Duplicate?

@lpinca

lpinca Mar 5, 2017

Member

Duplicate?

@jasnell

jasnell approved these changes Mar 6, 2017

joyeecheung added some commits Mar 4, 2017

net: fix server.listen error message
Previously the error messages are mostly `[object Object]`
after the options get normalized. Use util.inspect to make
it more useful.
test: test net.Server.listen options
Refactor the listen option test, add precise
error message validation and a few more test cases.
@joyeecheung

This comment has been minimized.

Show comment
Hide comment
@joyeecheung

joyeecheung Mar 8, 2017

Member

Got a conflict after #11667 landed. Rebased.

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

Member

joyeecheung commented Mar 8, 2017

Got a conflict after #11667 landed. Rebased.

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

@fhinkel

fhinkel approved these changes Mar 9, 2017

@fhinkel

This comment has been minimized.

Show comment
Hide comment
@fhinkel

fhinkel Mar 9, 2017

Member

Thanks. Squashed and landed in 4775942

Member

fhinkel commented Mar 9, 2017

Thanks. Squashed and landed in 4775942

@fhinkel fhinkel closed this Mar 9, 2017

fhinkel added a commit that referenced this pull request Mar 9, 2017

lib, test: fix server.listen error message
Previously the error messages are mostly `[object Object]`
after the options get normalized. Use util.inspect to make
it more useful.

Refactor the listen option test, add precise
error message validation and a few more test cases.

PR-URL: #11693
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>

jungx098 added a commit to jungx098/node that referenced this pull request Mar 21, 2017

lib, test: fix server.listen error message
Previously the error messages are mostly `[object Object]`
after the options get normalized. Use util.inspect to make
it more useful.

Refactor the listen option test, add precise
error message validation and a few more test cases.

PR-URL: nodejs#11693
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>

@jasnell jasnell referenced this pull request Apr 4, 2017

Closed

8.0.0 Release Proposal #12220

@joyeecheung joyeecheung referenced this pull request Apr 11, 2017

Closed

test: add more test cases of server.listen option #11778

3 of 3 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment