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

from_iterable does not handle exceptions in iterables #10

Open
dmzkrsk opened this issue Jun 28, 2017 · 0 comments
Open

from_iterable does not handle exceptions in iterables #10

dmzkrsk opened this issue Jun 28, 2017 · 0 comments

Comments

@dmzkrsk
Copy link

dmzkrsk commented Jun 28, 2017

import asyncio
from aioreactive.core import AsyncObservable, run


async def generator():
    # Also fails with sync generators
    for i in range(10):
        if i > 2:
            print("Let's raise")
            raise ValueError(i)
            # stream hangs here

        await asyncio.sleep(.1)
        print('Yield', i)
        yield i


async def main():
    iterable = generator()
    observer = AsyncObservable.from_iterable(iterable)
    await run(observer, timeout=None)


if __name__ == '__main__':
    loop = asyncio.get_event_loop()
    loop.run_until_complete(main())
    loop.close()

So the flow is simply hangs after the exception is thrown in the generator

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

1 participant