GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||
GeezerVison is showing github.com — stream: ensure Stream.pipeline re-emits errors without callback by phated · Pull Request #20437 · nodejs/node Conversation
Contributor
Fixes an issue where Stream.pipeline wouldn't re-emit errors Fixes: #20303 Checklist
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
addaleax
approved these changes
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems to make sense, but I find it hard to tell how this part of the change relates to the rest. It feels like this should be something that comes with tests too?
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @addaleax so i stumbled around for ~2 days on this. Without cleaning up after end-of-stream, my re-emitted error was still being handled by the Would that go in this PR? A separate commit? I'm not sure the process here.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, makes sense. I think single PR and single commit is fine (but especially in the case of splitting into commits that correspond to logical changes you can use your own judgement). I think you can feel free to add a comment here that describes how this relates to the error handling, but this should be fine as-is.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've forced pushed an updated comment that describes what I've explained above.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
phated
force-pushed
the
stream-pipeline-reemit-errors
branch
from
a490a89 to
d42c4d4
Compare
Member
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Member
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Member
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Member
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Member
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Contributor
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
|
There was an error while loading. Please reload this page.
|
@jasnell if I understand your approach correct you want to do: pipeline() function pipeline(callback) { callback = callback || (err) => { if (err) throw err; } // Do stuff } To me this does not seem like a good approach since this will always end up as uncaught exception. Or did I misunderstand something? I personally suggest to just force the user to always add a callback. If non is added, we just throw an error as we do in other APIs as well. If the user wants to ignore errors, that is totally fine. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@phated I would do that, yes. 👍 It seems like that’s at least something that you, me, @jasnell and @mafintosh can be behind.
@BridgeAR Also okay with me, but maybe for a follow-up PR since that’s tightening up behaviour even more? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
d42c4d4 to
c636365
Compare
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Still LGTM
Sorry, something went wrong.
There was an error while loading. Please reload this page.
It does tighten the current rule but I highly prefer that over the current PR implementation. I think throwing async is a really bad idea. Using emit would be a way the user could deal with it properly but always triggering uncaught exceptions is 😕 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
I agree that generating uncaught exceptions is 😕, but it’s something for which users have a clear way to address. More practically speaking, I think this PR could pass as not being semver-major (because there are cases where it’s known that no error is going to occur, and for the other cases this is effectively not silencing errors that should not be silenced, so a bug fix) whereas making the callback non-optional is definitely semver-major imo. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Where are we at on this one? Definitely needs a rebase. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
This has been sitting for approval and feedback for a long time and I probably won't have time to rebase this coming up. Can someone else take that on? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@mafintosh are you still -1 on this? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@mcollina I think there are plenty of valid usecases where you don't want a cb because all error handling is contained in the pipeline (like a simple I wouldn't block a merge though if people felt like it's super important. This change https://github.com/nodejs/node/pull/20437/files#diff-eefad5e8051f1634964a3847b691ff84R49 should not be there IMO though as it makes error handling in practice tricky. With that change if a stream emits an error after |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Marking my request of change explicit, so it does not get landed accidentally.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I think this should not be done here. 'error' can still happen after 'end', making error handling more tricky.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@mafintosh as a general thing: you would be strongly against requiring a callback all the time? This is the default for pretty much everything async in Node.js and it would also solve this issue. Every user could easily just add a no-op callback in case they want to ignore that. Adding an explicit documentation about this should probably sufficient to explain this to users, don't you think so? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@BridgeAR not strongly against it, just personal preference. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Fixes an issue where Stream.pipeline wouldn't re-throw errors on a stream if no callback was specified, thus swallowing said errors. Fixes: nodejs#20303
c636365 to
44d3fe3
Compare
|
@addaleax @mcollina I've made rebased and made the desired changes. Can we get this wrapped up so I don't need to spend even more time rebasing and stuff? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
This is ready to land with a green CI. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
👍 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Landed in c1012b4, thanks for the PR! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Fixes an issue where Stream.pipeline wouldn't re-throw errors on a stream if no callback was specified, thus swallowing said errors. Fixes: #20303 PR-URL: #20437 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Fixes an issue where Stream.pipeline wouldn't re-throw errors on a stream if no callback was specified, thus swallowing said errors. Fixes: #20303 PR-URL: #20437 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Stream.pipeline does not re-emit errors without callback
There was an error while loading. Please reload this page.