Skip to content

Does ClientWebSocketResponse.receive() and ClientWebSocketResponse.close() ever raise an exception? #7337

Closed Answered by Dreamsorcerer
RainerZufall187 asked this question in Q&A
Discussion options

You must be logged in to vote

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.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by RainerZufall187
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants