Does ClientWebSocketResponse.receive()
and ClientWebSocketResponse.close()
ever raise an exception?
#7337
-
^^^^^^^^^^^^ |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Well, yes, there's a RuntimeError if you misuse it: A TimeoutError if you use the timeout: Looks like other exceptions are caught and turned into WSMessages though.
|
Beta Was this translation helpful? Give feedback.
-
ok so there is no need for try and except |
Beta Was this translation helpful? Give feedback.
Well, yes, there's a RuntimeError if you misuse it:
https://github.com/aio-libs/aiohttp/blob/master/aiohttp/client_ws.py#L238
A TimeoutError if you use the timeout:
https://github.com/aio-libs/aiohttp/blob/master/aiohttp/client_ws.py#L260
Looks like other exceptions are caught and turned into WSMessages though.
close()
looks pretty safe, I wouldn't expect an exception to occur there.