Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.4k
http2: fix ping callback#20311
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
http2: fix ping callback #20311
Uh oh!
There was an error while loading. Please reload this page.
Conversation
BridgeAR commented Apr 26, 2018 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
In case there was no ack, the callback would have returned more than the error as return value. This makes sure that is not the case anymore.
If `common.expectsError` is used as a callback, it will now also verify that there is only one argument (the expected error).
56e627b to 6202d98CompareBridgeAR commented Apr 26, 2018
@nodejs/http @nodejs/http2 PTAL |
jasnell left a comment
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.
Passing the payload is intentional here as that is what is used to correlate. I'm -1 to removing it.
BridgeAR commented Apr 26, 2018
@jasnell can you please elaborate? IMO this is against the default Node.js callback standard. In case of an error we normally only return the error and nothing else. |
jasnell commented Apr 26, 2018
functionpingCallback(err,duration,payload){if(err){console.log(`Ping with payload "${payload.toString()}" failed`);}else{console.log(`Ping with payload "${payload.toString()}" succeeded with duration ${duration}`);}}session.ping(Buffer.from('12345678'),pingCallback);session.ping(Buffer.from('87654321'),pingCallback); |
BridgeAR commented Apr 26, 2018
To me this is very surprising to rely on any arguments if an error was returned. Any other opinions @nodejs/http2 @nodejs/tsc? |
addaleax commented Apr 26, 2018
As long as it’s documented this way, what are the issues with providing more information than just the error? |
BridgeAR commented Apr 27, 2018
Somewhat related: #20335 The documentation states: The payload will be undefined in case of an error and there is no Aside from that I expect all Node.js callbacks to always only return the error in an error case. Otherwise it seems like Schrödinger's cat to me. You get some results but also an error. What should you now work with? |
mcollina left a comment
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.
LGTM
In case there was no ack, the callback would have returned more than the error as return value. This makes sure that is not the case anymore. PR-URL: nodejs#20311 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
If `common.expectsError` is used as a callback, it will now also verify that there is only one argument (the expected error). PR-URL: nodejs#20311 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
BridgeAR commented Apr 29, 2018
In case there was no ack, the callback would have returned more than the error as return value. This makes sure that is not the case anymore. PR-URL: #20311 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
If `common.expectsError` is used as a callback, it will now also verify that there is only one argument (the expected error). PR-URL: #20311 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
In case there was no ack, the callback would have returned more than the error as return value. This makes sure that is not the case anymore. PR-URL: nodejs#20311 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
If `common.expectsError` is used as a callback, it will now also verify that there is only one argument (the expected error). PR-URL: nodejs#20311 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
In case there was no ack, the callback would have returned more than the error as return value. This makes sure that is not the case anymore. PR-URL: nodejs#20311 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
If `common.expectsError` is used as a callback, it will now also verify that there is only one argument (the expected error). PR-URL: nodejs#20311 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
In case there was no ack, the callback would have returned more than the error as return value. This makes sure that is not the case anymore. PR-URL: nodejs#20311 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
If `common.expectsError` is used as a callback, it will now also verify that there is only one argument (the expected error). PR-URL: nodejs#20311 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
In case there was no ack, the callback would have returned more than the error as return value. This makes sure that is not the case anymore. PR-URL: nodejs#20311 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
If `common.expectsError` is used as a callback, it will now also verify that there is only one argument (the expected error). PR-URL: nodejs#20311 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
In case there was no ack, the callback would have returned more than the error as return value. This makes sure that is not the case anymore. Backport-PR-URL: #22850 PR-URL: #20311 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
If `common.expectsError` is used as a callback, it will now also verify that there is only one argument (the expected error). Backport-PR-URL: #22850 PR-URL: #20311 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
In case there was no ack, the callback would have returned
more than the error as return value. This makes sure that is not
the case anymore.
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes