diff options
-rw-r--r-- | CHANGES | 2 | ||||
-rw-r--r-- | redis/connection.py | 11 |
2 files changed, 9 insertions, 4 deletions
@@ -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 |