Open
Description
There is currently no way that I am aware of to handle stream errors in await for
loops without breaking the loop.
/// This works, but any error will break the loop and close the subscription
try {
await for (var e in service.probeEvents()) {
status = status.copyWith(probes: e);
yield status;
}
} on StreamException {
///
} catch (e) {
///
}
I am proposing that we add syntax on await for
as an added feature.
/// Proposing this syntax, where errors will not break the loop
await for (var e in service.probeEvents()) {
status = status.copyWith(probes: e);
yield status;
} on StreamException {
///
} catch (e) {
///
} finally {
/// onDone
}