FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

lib: refactor to use validateCallback by Lxxyx · Pull Request #36609 · nodejs/node · GitHub

/ node Public

lib: refactor to use validateCallback - #36609

Closed
Lxxyx wants to merge 1 commit into
nodejs:masterfrom
Lxxyx:refactor-to-use-validate-callback
Closed

lib: refactor to use validateCallback#36609
Lxxyx wants to merge 1 commit into
nodejs:masterfrom
Lxxyx:refactor-to-use-validate-callback

Conversation

Lxxyx commented Dec 23, 2020

Copy link
Copy Markdown
Member

Try replacing all duplicate checks with validateCallback, Due to the scope of the changes, it may be necessary to run a benchmark.

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

nodejs-github-bot added the lib / src Issues and PRs related to general changes in the lib or src directory. label Dec 23, 2020

Trott left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Definitely not for this PR, but for what it's worth, I'd be in favor getting rid of ERR_INVALID_CALLBACK entirely and using ERR_INVALID_ARG_TYPE instead. It is very difficult for me to imagine a situation where ERR_INVALID_CALLBACK is more useful to someone than ERR_INVALID_ARG_TYPE. On the other hand, it is easy for me to imagine a situation where someone has to check for both ERR_INVALID_ARG_TYPE and ERR_INVALID_CALLBACK but they don't know it and they're only checking for ERR_INVALID_ARG_TYPE. Node.js has too many error codes and they are often not specific in a way that is helpful to end users. ERR_INVALID_CALLBACK seems to be one of those cases.

Trott added the request-ci Add this label to start a Jenkins CI on a PR. label Dec 23, 2020
github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Dec 23, 2020

Copy link
Copy Markdown
Collaborator

Lxxyx commented Dec 23, 2020

Copy link
Copy Markdown
Member Author

Definitely not for this PR, but for what it's worth, I'd be in favor getting rid of ERR_INVALID_CALLBACK entirely and using ERR_INVALID_ARG_TYPE instead. It is very difficult for me to imagine a situation where ERR_INVALID_CALLBACK is more useful to someone than ERR_INVALID_ARG_TYPE. On the other hand, it is easy for me to imagine a situation where someone has to check for both ERR_INVALID_ARG_TYPE and ERR_INVALID_CALLBACK but they don't know it and they're only checking for ERR_INVALID_ARG_TYPE. Node.js has too many error codes and they are often not specific in a way that is helpful to end users. ERR_INVALID_CALLBACK seems to be one of those cases.

Thanks for the reply, very valuable thought. node.js does have too many error codes, I was confused when I first opened the error.js file too.

ERR_INVALID_CALLBACK and ERR_INVALID_ARG_TYPE are also duplicates, and I personally agree with using ERR_INVALID_ARG_TYPE for both.

However, ERR_INVALID_CALLBACK being a widely used error code, replacing it with ERR_INVALID_ARG_TYPE may cause compatibility issues. Perhaps we can replace it with ERR_INVALID_ARG_TYPE in the next major release?

Copy link
Copy Markdown
Collaborator

aduh95 added author ready PRs that have at least one approval, no outstanding review comments, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Dec 28, 2020
github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Dec 28, 2020

Copy link
Copy Markdown
Collaborator

aduh95 added the commit-queue Add this label to land a pull request using GitHub Actions. label Dec 29, 2020
github-actions Bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Dec 29, 2020

Copy link
Copy Markdown
Contributor

Landed in 8cf5ae0...b00bb01

github-actions Bot closed this Dec 29, 2020
nodejs-github-bot pushed a commit that referenced this pull request Dec 29, 2020
PR-URL: #36609
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
danielleadams pushed a commit that referenced this pull request Jan 12, 2021
PR-URL: #36609
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
danielleadams mentioned this pull request Jan 12, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no outstanding review comments, and a CI started. lib / src Issues and PRs related to general changes in the lib or src directory.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants


Back | FazBrowse Home | New Git URL