-
Notifications
You must be signed in to change notification settings - Fork 28.5k
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
stream: give error message if write()
cb called twice
#19510
Conversation
Otherwise, this condition would result in an error that just reads `cb is not a function`, and which additionally could have lost stack trace context through a `process.nextTick()` call. $ ./node benchmark/compare.js --new ./node --old ./node-master --filter writable --runs 200 streams | Rscript benchmark/compare.R [00:09:36|% 100| 1/1 files | 400/400 runs | 1/1 configs]: Done confidence improvement accuracy (*) (**) (***) streams/writable-manywrites.js n=2000000 -0.28 % ±3.51% ±4.62% ±5.92%
@nodejs/streams |
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, but why not just reuse the existing ERR_MULTIPLE_CALLBACK
error?
👍 to @cjihrig's suggestion. |
Yeah, done. Just didn’t know that that existed. :) |
@addaleax I think you forgot to remove |
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
I flagged this as semver-major, mainly because it changes the error message and because it uses the new errors (which is semver-major for readable-stream). |
I would respectfully disagree. As said in the commit message, the previous error message came from trying to call But more importantly, there is no reason to ever test this error message. It's always a programming error, not some condition that could be detected at runtime.
Can you expand on that? We already use the new errors in the streams code, and it isn't obvious how readable-stream's semver levels relate to Node core's int hese situations_ |
My only concern is that this does not get into 6, 8 or 9. This is why I flagged as semver-major. I'm good with do-not-land tags for all release lines as well. I won't land this into the 2.x.x line of readable-stream, and that is currently tracking Node 8. |
Otherwise, this condition would result in an error that just reads `cb is not a function`, and which additionally could have lost stack trace context through a `process.nextTick()` call. PR-URL: nodejs#19510 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Landed in d111d7b 🎉 |
Otherwise, this condition would result in an error that just reads
cb is not a function
, and which additionally could have loststack trace context through a
process.nextTick()
call.Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes