Skip to content

Commit 7c32221

Browse files
committed
fix incorrect error interpretation
1 parent 0b64fc3 commit 7c32221

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

scratchattach/cloud/_base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ def receive_new(self, non_blocking: bool = False, timeout: Optional[float] = 0):
169169
# print("Receiving...")
170170
try:
171171
received = self.source_cloud.websocket.recv().splitlines()
172-
except websocket.WebSocketTimeoutException:
172+
except (websocket.WebSocketTimeoutException, ssl.SSLWantReadError):
173173
return
174174
# print(f"{received=}")
175175
self.packets_left.extend(received)
@@ -206,7 +206,7 @@ def read(self, amount: int = -1) -> Iterator[dict[str, Any]]:
206206
# this could happen e.g. when the scratchattach server sends the message
207207
# "This server uses @TimMcCool's scratchattach 2.0.0"
208208
warnings.warn(f"Invalid JSON sent from server: {e}")
209-
except (websocket.WebSocketConnectionClosedException, ssl.SSLWantReadError):
209+
except websocket.WebSocketConnectionClosedException:
210210
self.wait_before_reconnect()
211211
self.source_cloud.reconnect()
212212
except Exception:

0 commit comments

Comments
 (0)