Skip to content

Commit b86c0f1

Browse files
committed
Switch back to ConnectionError for initial connection
1 parent 34618a0 commit b86c0f1

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

factorio_rcon/factorio_rcon.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,7 @@ def connect(self):
7676
Params:
7777
No params.
7878
Raises:
79-
OSError: if there is an error initialising the connection to the server.
80-
ConnectionError: if there is an error during communication with the server.
79+
ConnectionError: if there is an error connecting to or communicating with the server.
8180
The error message details the exact nature of the error.
8281
Returns:
8382
Nothing returned.
@@ -92,8 +91,8 @@ def connect(self):
9291
self.rcon_socket.settimeout(self.timeout)
9392
try:
9493
self.rcon_socket.connect((self.ip_address, self.port))
95-
except OSError as exc:
96-
raise OSError(CONNECT_ERROR) from exc
94+
except ConnectionError as exc:
95+
raise ConnectionError(CONNECT_ERROR) from exc
9796
self.id_seq = 0
9897
self.send_packet(0, 3, self.password)
9998
responses = self.receive_packets()
@@ -256,8 +255,7 @@ async def connect(self):
256255
Params:
257256
No params.
258257
Raises:
259-
OSError: if there is an error initialising the connection to the server.
260-
ConnectionError: if there is an error during communication with the server.
258+
ConnectionError: if there is an error connecting to or communicating with the server.
261259
The error message details the exact nature of the error.
262260
Returns:
263261
Nothing returned.
@@ -270,8 +268,8 @@ async def connect(self):
270268
self.socket_locked = False
271269
try:
272270
self.rcon_socket = await anyio.connect_tcp(self.ip_address, self.port)
273-
except OSError as exc:
274-
raise OSError(CONNECT_ERROR) from exc
271+
except ConnectionError as exc:
272+
raise ConnectionError(CONNECT_ERROR) from exc
275273
await self.send_packet(0, 3, self.password)
276274
responses = await self.receive_packets()
277275
for response in responses:

0 commit comments

Comments
 (0)