fix: replace silent break with exception raise on ws close and error in RPC.receive
Replace two silent `break` statements with explicit `Exception` raises when WebSocket closes or encounters an error, and remove a stray debug print statement. This ensures the caller is notified of connection failures instead of silently exiting the receive loop.
This commit is contained in:
parent
e078ef918b
commit
cfbd5a1ce4
@ -116,10 +116,9 @@ class RPC:
|
||||
print("Error while receiving:", ex)
|
||||
break
|
||||
if msg.type == aiohttp.WSMsgType.CLOSED:
|
||||
break
|
||||
raise Exception("WebSocket closed.")
|
||||
elif msg.type == aiohttp.WSMsgType.ERROR:
|
||||
print("WebSocket error:", msg)
|
||||
break
|
||||
raise Exception("WebSocket error:", msg)
|
||||
elif msg.type == aiohttp.WSMsgType.TEXT:
|
||||
|
||||
if self.current_call_id and not msg.json().get('callId') != self.current_call_id:
|
||||
@ -134,5 +133,4 @@ class RPC:
|
||||
break
|
||||
else:
|
||||
raise Exception("Unexpected message type.")
|
||||
print("huh")
|
||||
return None
|
||||
|
||||
Loading…
Reference in New Issue
Block a user