Skip to content
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

lib: fix validateport error message when allowZero is false #32861

Closed
wants to merge 1 commit into from

Conversation

rickyes
Copy link
Contributor

@rickyes rickyes commented Apr 15, 2020

fixes: #32857

/cc @jasnell

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added the errors Issues and PRs related to JavaScript errors originated in Node.js core. label Apr 15, 2020
@rickyes rickyes force-pushed the fix-validateport-errmsg branch from 8fc220c to 7cb9849 Compare April 15, 2020 06:08
@rickyes rickyes changed the title lib: fix validateport error message when allowZero = false lib: fix validateport error message when allowZero is false Apr 15, 2020
@rickyes
Copy link
Contributor Author

rickyes commented Apr 15, 2020

It seems that there is a problem with install deps when building on windows.

Failures
 - nasm (exited 1) - nasm not installed. An error occurred during installation:
 The remote server returned an error: (503) Server Unavailable. Service Unavailable

lib/internal/errors.js Outdated Show resolved Hide resolved
@rickyes rickyes force-pushed the fix-validateport-errmsg branch from 7cb9849 to b5ac0f0 Compare April 15, 2020 07:24
Copy link
Member

@himself65 himself65 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM if CI passes

Copy link
Contributor

@cjihrig cjihrig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

No need to change this PR, but It's kind of funny that there was discussion about making the third argument to validatePort() an object vs. a boolean for readability purposes, just to end up using a boolean here anyway. It seems like we should migrate the validatePort() arg to a boolean - it's an internal API anyway.

@rickyes
Copy link
Contributor Author

rickyes commented Apr 15, 2020

LGTM.

No need to change this PR, but It's kind of funny that there was discussion about making the third argument to validatePort() an object vs. a boolean for readability purposes, just to end up using a boolean here anyway. It seems like we should migrate the validatePort() arg to a boolean - it's an internal API anyway.

I think making the third parameter of validatePort() an object is actually to consider compatibility with different ranges of ports in the future.

@cjihrig
Copy link
Contributor

cjihrig commented Apr 15, 2020

I think making the third parameter of validatePort() an object is actually to consider compatibility with different ranges of ports in the future.

It was to avoid "magical boolean values"

@jasnell
Copy link
Member

jasnell commented Apr 15, 2020

  • Avoiding magical booleans
  • API consistency (some of the validation function accepted options objects others did not)
  • Support for additional options in the future without changing API signature

@cjihrig
Copy link
Contributor

cjihrig commented Apr 15, 2020

API consistency (some of the validation function accepted options objects others did not)

To be fair, more of them do not take an options object, so it introduced more inconsistency.

@nodejs-github-bot
Copy link
Collaborator

@rickyes
Copy link
Contributor Author

rickyes commented Apr 25, 2020

Should be ready, Can you help restart a CI run ? @jasnell

@nodejs-github-bot
Copy link
Collaborator

@rickyes
Copy link
Contributor Author

rickyes commented Apr 25, 2020

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

It seems that the CI run failure has nothing to do with this PR.

11:56:22 not ok 2559 parallel/test-worker-message-port-message-before-close
11:56:22   ---
11:56:22   duration_ms: 120.104
11:56:22   severity: fail
11:56:22   exitcode: -15
11:56:22   stack: |-
11:56:22     timeout

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

addaleax pushed a commit that referenced this pull request Apr 28, 2020
PR-URL: #32861
Fixes: #32857
Reviewed-By: Zeyu Yang <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
@addaleax
Copy link
Member

Landed in 1d0b249

@addaleax addaleax closed this Apr 28, 2020
@rickyes rickyes deleted the fix-validateport-errmsg branch April 28, 2020 17:24
targos pushed a commit that referenced this pull request May 4, 2020
PR-URL: #32861
Fixes: #32857
Reviewed-By: Zeyu Yang <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
@targos targos mentioned this pull request May 4, 2020
targos pushed a commit that referenced this pull request May 7, 2020
PR-URL: #32861
Fixes: #32857
Reviewed-By: Zeyu Yang <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
targos pushed a commit that referenced this pull request May 13, 2020
PR-URL: #32861
Fixes: #32857
Reviewed-By: Zeyu Yang <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
errors Issues and PRs related to JavaScript errors originated in Node.js core.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ERR_SOCKET_BAD_PORT's static-typed error is not affected by validatePort's allowZero value
8 participants