src: fix error message in async_hooks constructor#19000
Closed
danbev wants to merge 2 commits intonodejs:masterfrom
Closed
src: fix error message in async_hooks constructor#19000danbev wants to merge 2 commits intonodejs:masterfrom
danbev wants to merge 2 commits intonodejs:masterfrom
Conversation
There are two minor issues in the AsyncHook constructor, if the object passed in has an after and/or destroy property that are not functions the errors thrown will still be: TypeError [ERR_ASYNC_CALLBACK]: before must be a function This commit updates the code and adds a unit test.
Contributor
Author
cjihrig
approved these changes
Feb 26, 2018
TimothyGu
reviewed
Feb 26, 2018
lib/async_hooks.js
Outdated
| @@ -45,9 +45,9 @@ class AsyncHook { | |||
| if (before !== undefined && typeof before !== 'function') | |||
| throw new errors.TypeError('ERR_ASYNC_CALLBACK', 'before'); | |||
Member
There was a problem hiding this comment.
How about passing 'hook.before' as the option name? Usually a bare identifier means a function parameter.
Contributor
Author
There was a problem hiding this comment.
Sounds good, I'll take a look. Thanks
|
|
||
| common.expectsError(() => { | ||
| async_hooks.createHook({ promiseResolve: non_function }); | ||
| }, typeErrorForFunction('promiseResolve')); |
Member
There was a problem hiding this comment.
typeErrorForFunction could contain the common.expectsError logic as well.
Contributor
Author
There was a problem hiding this comment.
Sounds good as well, I update this. Thanks
jasnell
approved these changes
Feb 26, 2018
Member
jasnell
left a comment
There was a problem hiding this comment.
LGTM with the suggested changes.
Contributor
Author
ef785fa to
8a43ed1
Compare
Contributor
Author
mmarchini
approved these changes
Feb 27, 2018
TimothyGu
approved these changes
Feb 27, 2018
Contributor
Author
node-test-commit failure looks unrelatednot ok 1043 parallel/test-https-host-headers
---
duration_ms: 1.101
severity: fail
stack: |-
test https server listening on port 45571
Got request: localhost:45571 /0
/home/iojs/build/workspace/node-test-commit-arm/nodes/ubuntu1604-arm64/test/parallel/test-https-host-headers.js:32
throw er;
^
Error: 281472848347136:error:1408F119:SSL routines:SSL3_GET_RECORD:decryption failed or bad record mac:../deps/openssl/openssl/ssl/s3_pkt.c:535:
... |
Contributor
Author
|
Landed in f2defca. |
danbev
added a commit
that referenced
this pull request
Feb 28, 2018
There are two minor issues in the AsyncHook constructor, if the object passed in has an after and/or destroy property that are not functions the errors thrown will still be: TypeError [ERR_ASYNC_CALLBACK]: before must be a function This commit updates the code and adds a unit test. PR-URL: #19000 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matheus Marchini <matheus@sthima.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
addaleax
pushed a commit
to addaleax/node
that referenced
this pull request
Mar 5, 2018
There are two minor issues in the AsyncHook constructor, if the object passed in has an after and/or destroy property that are not functions the errors thrown will still be: TypeError [ERR_ASYNC_CALLBACK]: before must be a function This commit updates the code and adds a unit test. PR-URL: nodejs#19000 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matheus Marchini <matheus@sthima.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Merged
MayaLekova
pushed a commit
to MayaLekova/node
that referenced
this pull request
May 8, 2018
There are two minor issues in the AsyncHook constructor, if the object passed in has an after and/or destroy property that are not functions the errors thrown will still be: TypeError [ERR_ASYNC_CALLBACK]: before must be a function This commit updates the code and adds a unit test. PR-URL: nodejs#19000 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matheus Marchini <matheus@sthima.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
jasnell
pushed a commit
to jasnell/node
that referenced
this pull request
Aug 17, 2018
There are two minor issues in the AsyncHook constructor, if the object passed in has an after and/or destroy property that are not functions the errors thrown will still be: TypeError [ERR_ASYNC_CALLBACK]: before must be a function This commit updates the code and adds a unit test. PR-URL: nodejs#19000 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matheus Marchini <matheus@sthima.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
MylesBorins
pushed a commit
that referenced
this pull request
Sep 6, 2018
There are two minor issues in the AsyncHook constructor, if the object passed in has an after and/or destroy property that are not functions the errors thrown will still be: TypeError [ERR_ASYNC_CALLBACK]: before must be a function This commit updates the code and adds a unit test. Backport-PR-URL: #22380 PR-URL: #19000 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matheus Marchini <matheus@sthima.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Merged
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
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.
There are two minor issues in the AsyncHook constructor, if the object
passed in has an after and/or destroy property that are not functions
the errors thrown will still be:
TypeError [ERR_ASYNC_CALLBACK]: before must be a functionThis commit updates the code and adds a unit test.
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
src