-
Notifications
You must be signed in to change notification settings - Fork 213
await for ... on ... catch syntax #1441
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
Comments
(Edit: Focusing on the issue at hand, instead of getting sidetracked into ideas for other features). Catching the situation where a stream emits an error in an await for: await for (var e in stream) {
body
} on SomeError catch (e) {
catchBody
} makes a kind of sense. It corresponds to the It feels right-ish to me that it comes after the body, but attached to the same loop. Most streams do not have multiple errors, or errors that are not fatal, but there are some. (Maybe that was a bad idea, but for broadcast streams it felt right). This is not something which is important often, but it is relevant in some cases, and not supported. Should we also allow (It's very hard to create errors inside streams using (Arguably it could also apply to an iterable iteration where the |
There's a lot to tease out here for new features. One that comes to mind is
|
What am I looking for? |
There is currently no way that I am aware of to handle stream errors in
await for
loops without breaking the loop.I am proposing that we add syntax on
await for
as an added feature.The text was updated successfully, but these errors were encountered: