Skip to content
This repository has been archived by the owner on Feb 21, 2023. It is now read-only.

fix socket.error raises #1129

Merged
merged 16 commits into from Nov 29, 2021
1 change: 1 addition & 0 deletions CHANGES/1129.bugfix
@@ -0,0 +1 @@
fixed raw socket.error (or one of its subclasses) raises instead of a redis.exceptions.ConnectionError
5 changes: 5 additions & 0 deletions aioredis/connection.py
Expand Up @@ -901,6 +901,11 @@ async def read_response(self):
except asyncio.TimeoutError:
await self.disconnect()
raise TimeoutError(f"Timeout reading from {self.host}:{self.port}")
except OSError as e:
x0day marked this conversation as resolved.
Show resolved Hide resolved
await self.disconnect()
raise ConnectionError(
f"Error while reading from {self.host}:{self.port} : {e.args}"
)
except BaseException:
await self.disconnect()
raise
Expand Down
2 changes: 1 addition & 1 deletion aioredis/exceptions.py
Expand Up @@ -7,7 +7,7 @@ class RedisError(Exception):
pass


class ConnectionError(builtins.ConnectionError, RedisError):
class ConnectionError(RedisError):
pass


Expand Down