Uh oh!
There was an error while loading. Please reload this page.
stream: fix error handling with async iteration - #20329
Conversation
Fix an issue when an error was emitted by the stream before `iterator.next()` is called.
| read() {} | ||
| }) | ||
| let err |
There was a problem hiding this comment.
Nit, missing semicolon. Please run make lint :)
| } catch (e) { | ||
| err = e; | ||
| } | ||
| assert.strictEqual(err.message, 'kaboom'); |
There was a problem hiding this comment.
Can we assert that we have reference equality and assert Node doesn't mutate the error (basically define the error above and assert that strictEqual on the instance?
Also - you can use the newly added assert.rejects (although no obligation)
| console.log('call next() after error'); | ||
| const readable = new Readable({ | ||
| read() {} | ||
| }) |
benjamingr
left a comment
There was a problem hiding this comment.
First of all - good to see you here.
Second - thank you for doing this - any feedback about the Symbol.asyncIterator feature is greatly appreciated.
Also - Good catch! I've left some comments. You're welcome to address them (and maybe amend the PR description to meet our standard format). If you won't a collaborator would do this for you when landing it.
julien-f
commented
Apr 26, 2018
Thanks for your welcome and comments 😃 I've fixed the code accordingly, but I still cannot run the tests so I'm not sure it works 😜 |
benjamingr
commented
Apr 26, 2018
@julien-f what issue are you having with running the tests? If you're having trouble running the tests let's:
We really want to avoid having contributors climb technical barriers in orders to contribute. In addition, I've kicked a CI for it: https://ci.nodejs.org/job/node-test-pull-request/14524/console |
julien-f
commented
Apr 26, 2018
@benjamingr No particular issues, I simply have never compiled Node on my machine and I don't have time to figure it out for the moment. |
benjamingr
commented
Apr 26, 2018
There seem to be some lint errors in the tests: https://ci.nodejs.org/job/node-test-linter/18544/console |
julien-f
commented
Apr 26, 2018
On it, sorry for this, I missed it 😳 |
benjamingr
commented
Apr 26, 2018
Don't worry about it, new CI: https://ci.nodejs.org/job/node-test-pull-request/14525/console Also note that while cloning and building Node sounds like a lot of work - it's actually not nearly as complicated as it appears. Basically: Assuming you have Python (comes built in on mac), git (which is common for developers) and a C++ compiler (which is an |
julien-f
commented
Apr 26, 2018
Ok, I successfully built it with |
benjamingr
commented
Apr 26, 2018
CI is green, what's going to happen next is that this will sit for 72 hours so collaborators have a chance to review it and then we'll land it if no one objects. (since it already has one approval). Any future work on async iterator support would be appreciated :) |
benjamingr
commented
Apr 27, 2018
Added [dont-land-on] labels for versions of Node that don't support async iterators. |
BridgeAR
commented
Apr 29, 2018
Landed in 9c48926 🎉 |
Fix an issue when an error was emitted by the stream before `iterator.next()` is called. PR-URL: nodejs#20329 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
benjamingr
commented
Apr 29, 2018
Welcome to the Node contributor ranks @julien-f ! Any follow-up work that you'd like to work up with in the async iterator space would be very appreciated and if you need any help or resources to better contribute by all means please reach out. |
Fix an issue when an error was emitted by the stream before `iterator.next()` is called. PR-URL: #20329 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Fix an issue when an error was emitted by the stream before
iterator.next()is called.Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesI don't have the time to figure out how to run the tests, sorry.
/cc @mcollina