GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — lib: refactor to use validateCallback by Lxxyx · Pull Request #36609 · nodejs/node

Conversation

@Lxxyx

@Lxxyx 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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

bricss reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@Lxxyx
lib: refactor to use validateCallback
e3c5a44
@nodejs-github-bot nodejs-github-bot added the lib / src Issues and PRs involving general changes in the lib/ or src/ directories. label Dec 23, 2020
Trott
Trott approved these changes Dec 23, 2020
View reviewed changes

@Trott Trott left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

RaisinTen reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@Trott Trott added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Dec 23, 2020
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Dec 23, 2020
@nodejs-github-bot

nodejs-github-bot commented Dec 23, 2020

Copy link
Copy Markdown
Collaborator

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Lxxyx

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?

Trott and RaisinTen reacted with thumbs up emoji
All reactions
  • 👍 2 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot

nodejs-github-bot commented Dec 28, 2020

Copy link
Copy Markdown
Collaborator

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

aduh95
aduh95 approved these changes Dec 28, 2020
View reviewed changes
@aduh95 aduh95 added author ready PRs with CI started, the required approvals, and no outstanding review comments. request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. labels Dec 28, 2020
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Dec 28, 2020
@nodejs-github-bot

nodejs-github-bot commented Dec 28, 2020

Copy link
Copy Markdown
Collaborator

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@aduh95 aduh95 added the commit-queue PRs queued for automated landing through the Commit Queue. label Dec 29, 2020
@github-actions github-actions Bot removed the commit-queue PRs queued for automated landing through the Commit Queue. label Dec 29, 2020
@github-actions

github-actions Bot commented Dec 29, 2020

Copy link
Copy Markdown
Contributor

Landed in 8cf5ae0...b00bb01

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot closed this Dec 29, 2020
nodejs-github-bot pushed a commit that referenced this pull request Dec 29, 2020
@Lxxyx @nodejs-github-bot
lib: refactor to use validateCallback
b00bb01
PR-URL: #36609
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
danielleadams pushed a commit that referenced this pull request Jan 12, 2021
@Lxxyx @danielleadams
lib: refactor to use validateCallback
7fe1b5e
PR-URL: #36609
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
@danielleadams danielleadams mentioned this pull request Jan 12, 2021
v15.6.0 proposal #36889
Merged
@Lxxyx Lxxyx mentioned this pull request Jan 24, 2021
lib: refactor to use validateFunction #37045
Closed
@targos targos added the dont-land-on-v14.x label May 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@Trott Trott Trott approved these changes
@aduh95 aduh95 aduh95 approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. lib / src Issues and PRs involving general changes in the lib/ or src/ directories.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@Lxxyx @nodejs-github-bot @Trott @aduh95 @targos
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.