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

dns: lookupService() callback must be a function #8170

Closed
wants to merge 2 commits into from

Conversation

cjihrig
Copy link
Contributor

@cjihrig cjihrig commented Aug 18, 2016

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

dns

Description of change

lookupService() requires a callback function. The first commit in this PR adds a check to verify that the callback is actually a function.

As a result of the first commit, the second commit drops a pointless check. makeAsync() is an internal method in the dns module. All of the functions that call makeAsync() have already validated that the callback is a function. The second commit removes a redundant typeof function check.

lookupService() already does not work unless a function is passed, but technically the change in error message makes this a semver major. It is worth noting that currently, if you pass an object as the callback, lookupService() does not throw immediately, and instead throws in an asynchronous callback. Perhaps that is enough to convince someone that this is a bug fix and not just a semver major error message change ;-)

lookupService() requires a callback function. This commit adds
a check to verify that the callback is actually a function.
makeAsync() is an internal method in the dns module. All of the
functions that call makeAsync() have already validated that the
callback is a function. This commit removes a redundant typeof
function check.
@nodejs-github-bot nodejs-github-bot added the dns Issues and PRs related to the dns subsystem. label Aug 18, 2016
@jasnell
Copy link
Member

jasnell commented Aug 18, 2016

Hmmmm.... my knee jerk reaction is semver-major but you're right, it didn't work previously if a function wasn't passed.... I think that's enough to label this a semver-patch.

@jasnell
Copy link
Member

jasnell commented Aug 18, 2016

The change itself LGTM

@evanlucas
Copy link
Contributor

LGTM

@yorkie
Copy link
Contributor

yorkie commented Aug 19, 2016

@cjihrig
Copy link
Contributor Author

cjihrig commented Aug 20, 2016

CI again because Jenkins: https://ci.nodejs.org/job/node-test-pull-request/3767/

jasnell pushed a commit that referenced this pull request Aug 22, 2016
lookupService() requires a callback function. This commit adds
a check to verify that the callback is actually a function.

PR-URL: #8170
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Yorkie Liu <yorkiefixer@gmail.com>
jasnell pushed a commit that referenced this pull request Aug 22, 2016
makeAsync() is an internal method in the dns module. All of the
functions that call makeAsync() have already validated that the
callback is a function. This commit removes a redundant typeof
function check.

PR-URL: #8170
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Yorkie Liu <yorkiefixer@gmail.com>
@jasnell
Copy link
Member

jasnell commented Aug 22, 2016

Landed in 3a43568 and 013d76c.
Marked as don't land in v4.x because of the questionable semveriness of this. We can look at bringing it back to v4 eventually once we're sure it doesn't break the planet.

@jasnell jasnell closed this Aug 22, 2016
@cjihrig cjihrig deleted the lookupservice branch August 23, 2016 01:21
evanlucas pushed a commit that referenced this pull request Aug 24, 2016
lookupService() requires a callback function. This commit adds
a check to verify that the callback is actually a function.

PR-URL: #8170
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Yorkie Liu <yorkiefixer@gmail.com>
evanlucas pushed a commit that referenced this pull request Aug 24, 2016
makeAsync() is an internal method in the dns module. All of the
functions that call makeAsync() have already validated that the
callback is a function. This commit removes a redundant typeof
function check.

PR-URL: #8170
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Yorkie Liu <yorkiefixer@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dns Issues and PRs related to the dns subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants