-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
extension FutureIterable<T>.wait
throws synchronously if iteration throws.
#59639
Comments
Summary: The |
Also posted as https://stackoverflow.com/questions/79242392/extension-futureiterablet-wait-does-not-work-properly-in-dart-flutter which got an answer. Do you still intend to have this issue open? As I mention in a comment on the SO post, you should mark foo "async" if you want it to return async errors when throwing exception. |
The I'd also worry about the |
@lrhn throwing synchronously changes the behavior, I'm not sure it's the intended design. While the solution is simple to fix here, I wonder if it's the default behavior you want... Throwing in
here the documentation doesn't match the current behavior @julemand101 while I found a solution, it doesn't mean the actual behavior makes sense. |
If you throw in It's very much the intended behavior to exit and fail if Can argue how to behave if The one thing that a failure can do, is to clean up in some way, and make sure to return an asynchronous error, even if it won't be a The operation expects an iterable of futures, and the caller had failed to provide one. That's an error, and not an error from any of the provided futures, so it should be reported separately. |
Please realize that my code doesn't reference any |
In this case, it isn't That's not any of the futures completing with an error, it's an error happening while trying to set up the initial state. It does seem that If iteration of the provided iterable fails with an error, I'll re-open as a reminder to change it to an asynchronrous error. |
extension FutureIterable<T>.wait
does not work properlyextension FutureIterable<T>.wait
throws synchronously if iteration throws.
I don't understand the behavior from a user perspective (Don't look at the Because
I hope you get my point, now it's up to you to decide |
The signature of the two functions might be the same, but one returns a The input to |
Could you clarify how an array of Future of len 5 can be something else? If there is no future then why the length is 5? I understand
Do we have a linter for that, do you see any legitimate use of synchronously throwing an error when returning a Future? It seems to create some strange behavior. |
extension FutureIterable<T>.wait
does not work properlyfrom the documentation:
The following code:
output:
I don't see any sign of
ParallelWaitError
, as the documentation mentions. And the future returns an error at the first exception.The text was updated successfully, but these errors were encountered: