Skip to content
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

Document Why the AsyncStream Is Not Throwing #4

Open
Frizlab opened this issue Jul 18, 2023 · 3 comments
Open

Document Why the AsyncStream Is Not Throwing #4

Frizlab opened this issue Jul 18, 2023 · 3 comments

Comments

@Frizlab
Copy link
Owner

Frizlab commented Jul 18, 2023

As the stream is never-ending, if the stream ends it’s because an error occurred.

@mattmassicotte
Copy link

Do you think it would be more appropriate if it was throwing?

@Frizlab
Copy link
Owner Author

Frizlab commented Jul 28, 2023

TL;DR: no.

Longer answer:
In general yes, because it allows getting the underlying error that made the operation fail. In this case however, our init is not throwing (it's only nullable): it makes sense to have a non-throwing iterator.
Additionally, as the stream is endless, it makes sense that if it ends, it's because it failed somehow.

Documenting this seems important though, so there is no doubt whatsoever for clients of the lib.

@mattmassicotte
Copy link

Thanks for the explanation. This makes sense!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants