Properly catch websocket CancelledError in websocket handler in Python 3.7 (#2463)
This commit is contained in:
parent
86ae5f981c
commit
4ee2e57ec8
|
@ -992,10 +992,10 @@ class Sanic(BaseSanic, RunnerMixin, metaclass=TouchUpMeta):
|
|||
cancelled = False
|
||||
try:
|
||||
await fut
|
||||
except Exception as e:
|
||||
self.error_handler.log(request, e)
|
||||
except (CancelledError, ConnectionClosed):
|
||||
cancelled = True
|
||||
except Exception as e:
|
||||
self.error_handler.log(request, e)
|
||||
finally:
|
||||
self.websocket_tasks.remove(fut)
|
||||
if cancelled:
|
||||
|
|
Loading…
Reference in New Issue
Block a user