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

Commit

Permalink
fix socket.error raises (#1129)
Browse files Browse the repository at this point in the history
  • Loading branch information
x0day committed Nov 29, 2021
1 parent 2ba15fb commit dbdd0ad
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
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:
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

0 comments on commit dbdd0ad

Please sign in to comment.