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

Improve debugging experience #31

Open
faroit opened this issue Jan 13, 2021 · 0 comments
Open

Improve debugging experience #31

faroit opened this issue Jan 13, 2021 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@faroit
Copy link
Contributor

faroit commented Jan 13, 2021

Currently the debugging experience of the io.download_single function is not idea since its inside of an async task. If an exception is raised inside of that function tasks are not stopped, thus makes is hard to debug it.

I added a watchdog decorator, but it doesn't work in all cases yet:

def watchdog(afunc):
"""Stops all tasks if there is an error"""
@functools.wraps(afunc)
async def run(*args, **kwargs):
try:
await afunc(*args, **kwargs)
except asyncio.CancelledError:
return
except Exception as err:
print(f'exception {err}')
asyncio.get_event_loop().stop()
return run

@faroit faroit added the enhancement New feature or request label Jan 13, 2021
@faroit faroit self-assigned this Jan 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant