summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES6
-rw-r--r--redis/__init__.py2
-rw-r--r--redis/connection.py32
3 files changed, 30 insertions, 10 deletions
diff --git a/CHANGES b/CHANGES
index dd061ae..a6066f9 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,9 @@
+* 2.4.3
+ * Fixed a bug in the UnixDomainSocketConnection caused when trying to
+ form an error message after a socket error.
+* 2.4.2
+ * Fixed a bug in pipeline that caused an exception while trying to
+ reconnect after a connection timeout.
* 2.4.1
* Fixed a bug in the PythonParser if disconnect is called before connect.
* 2.4.0
diff --git a/redis/__init__.py b/redis/__init__.py
index efd0c1e..fee785d 100644
--- a/redis/__init__.py
+++ b/redis/__init__.py
@@ -15,7 +15,7 @@ from redis.exceptions import (
)
-__version__ = '2.4.2'
+__version__ = '2.4.3'
__all__ = [
'Redis', 'ConnectionPool', 'Connection', 'UnixDomainSocketConnection',
diff --git a/redis/connection.py b/redis/connection.py
index 128c359..b0383f5 100644
--- a/redis/connection.py
+++ b/redis/connection.py
@@ -124,15 +124,7 @@ class Connection(object):
try:
sock = self._connect()
except socket.error, e:
- # args for socket.error can either be (errno, "message")
- # or just "message"
- if len(e.args) == 1:
- error_message = "Error connecting to %s:%s. %s." % \
- (self.host, self.port, e.args[0])
- else:
- error_message = "Error %s connecting %s:%s. %s." % \
- (e.args[0], self.host, self.port, e.args[1])
- raise ConnectionError(error_message)
+ raise ConnectionError(self._error_mesage(e))
self._sock = sock
self.on_connect()
@@ -144,6 +136,17 @@ class Connection(object):
sock.connect((self.host, self.port))
return sock
+ def _error_message(self, exception):
+ # args for socket.error can either be (errno, "message")
+ # or just "message"
+ if len(exception.args) == 1:
+ return "Error connecting to %s:%s. %s." % \
+ (self.host, self.port, exception.args[0])
+ else:
+ return "Error %s connecting %s:%s. %s." % \
+ (exception.args[0], self.host, self.port, exception.args[1])
+
+
def on_connect(self):
"Initialize the connection, authenticate and select a database"
self._parser.on_connect(self)
@@ -241,6 +244,17 @@ class UnixDomainSocketConnection(Connection):
sock.connect(self.path)
return sock
+ def _error_message(self, exception):
+ # args for socket.error can either be (errno, "message")
+ # or just "message"
+ if len(exception.args) == 1:
+ return "Error connecting to unix socket: %s. %s." % \
+ (self.path, exception.args[0])
+ else:
+ return "Error %s connecting to unix socket: %s. %s." % \
+ (exception.args[0], self.path, exception.args[1])
+
+
# TODO: add ability to block waiting on a connection to be released
class ConnectionPool(object):
"Generic connection pool"