summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES2
-rw-r--r--redis/connection.py11
2 files changed, 9 insertions, 4 deletions
diff --git a/CHANGES b/CHANGES
index 5226b3c..28c2248 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,7 @@
* 2.6.1 (in development)
* Python 3.x support! Big thanks to Alex Grönholm.
+ * Fixed a bug in the PythonParser's read_response that could hide an error
+ from the client (#251).
* 2.6.0
* Changed (p)subscribe and (p)unsubscribe to no longer return messages
indicating the channel was subscribed/unsubscribed to. These messages
diff --git a/redis/connection.py b/redis/connection.py
index a6a8caf..5a2d8df 100644
--- a/redis/connection.py
+++ b/redis/connection.py
@@ -96,13 +96,16 @@ class PythonParser(object):
# server returned an error
if byte == '-':
- if nativestr(response).startswith('ERR '):
- response = response[4:]
- return ResponseError(response)
if nativestr(response).startswith('LOADING '):
- # If we're loading the dataset into memory, kill the socket
+ # if we're loading the dataset into memory, kill the socket
# so we re-initialize (and re-SELECT) next time.
raise ConnectionError("Redis is loading data into memory")
+ # if the error starts with ERR, trim that off
+ if nativestr(response).startswith('ERR '):
+ response = response[4:]
+ # *return*, not raise the exception class. if it is meant to be
+ # raised, it will be at a higher level.
+ return ResponseError(response)
# single value
elif byte == '+':
pass