summaryrefslogtreecommitdiff
path: root/redis/connection.py
diff options
context:
space:
mode:
authorandy <andy@whiskeymedia.com>2013-06-14 09:50:23 -0700
committerandy <andy@whiskeymedia.com>2013-06-14 09:50:23 -0700
commit71176fc2046dde5c572b4c291c54c7f840acf3fa (patch)
treed9937d16823090990d1d9b5f6f1defabdb53e380 /redis/connection.py
parent44e9c7b3f1086e99f69cde984cf29c5305f7c080 (diff)
downloadredis-py-71176fc2046dde5c572b4c291c54c7f840acf3fa.tar.gz
fix for #358 and #351
Diffstat (limited to 'redis/connection.py')
-rw-r--r--redis/connection.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/redis/connection.py b/redis/connection.py
index 7e8cb44..4b509b1 100644
--- a/redis/connection.py
+++ b/redis/connection.py
@@ -113,9 +113,16 @@ class PythonParser(object):
# server returned an error
if byte == '-':
response = nativestr(response)
- # *return*, not raise the exception class. if it is meant to be
- # raised, it will be at a higher level.
- return self.parse_error(response)
+ error = self.parse_error(response)
+ # if the error is a ConnectionError, raise immediately so the user
+ # is notified
+ if isinstance(error, ConnectionError):
+ raise error
+ # otherwise, we're dealing with a ResponseError that might belong
+ # inside a pipeline response. the connection's read_response()
+ # and/or the pipeline's execute() will raise this error if
+ # necessary, so just return the exception instance here.
+ return error
# single value
elif byte == '+':
pass