[Idea/Draft/Proposal] Exception handling for server exceptions
- Dominant language
- Python
- Stars
- 1.7k
- Forks
- 778
- Avg merge
- 2h 50m
- Merged PRs (30d)
- 3
Description
Currently there are a lot of exceptions 'lost' in asyncio land because we schedule a lot of our coroutines as tornado callbacks, that's usually a pattern like `self.loop.add_callback(do_something_which_might_raise)` To not loose these exceptions, there is, for instance, the `log_errors` handler which logs the exception. Other than the logging system we currently do not have a method to retrieve these exceptions, neither for internal validation (e.g. tests) nor to propagate the exceptions programatically to users
I'm wondering if we can set up an [exception handler]( https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.loop.set_exception_handler ) and forward all exceptions to the running server. These may then be forwarded to the client where we may raise an exception or issue a log message there.
Users might probably want to configure the behaviour for the different kinds of exceptions, e.g. ignore CommClosed but raise on KeyError, etc.
Contributor guide
Assessment
This issue has not been assessed yet.