summaryrefslogtreecommitdiff
path: root/redis
diff options
context:
space:
mode:
authorth13f <fpm.th13f@gmail.com>2015-10-26 13:53:31 +0300
committerth13f <fpm.th13f@gmail.com>2015-10-26 13:53:31 +0300
commitd8507a7903c19a73a8bbcc33ce75c4f691890c2b (patch)
tree81eb50b4ecb486e66a1e664b49f2a65fa7730e23 /redis
parent93ee0b97faab8de46a77b8cf140f68912e921e0a (diff)
downloadredis-py-d8507a7903c19a73a8bbcc33ce75c4f691890c2b.tar.gz
parsing 'max number of clients reached' as ConnectionError
Diffstat (limited to 'redis')
-rwxr-xr-xredis/connection.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/redis/connection.py b/redis/connection.py
index 19d6925..98d3c04 100755
--- a/redis/connection.py
+++ b/redis/connection.py
@@ -80,7 +80,10 @@ class Token(object):
class BaseParser(object):
EXCEPTION_CLASSES = {
- 'ERR': ResponseError,
+ 'ERR': {
+ 'default': ResponseError,
+ 'max number of clients reached': ConnectionError
+ },
'EXECABORT': ExecAbortError,
'LOADING': BusyLoadingError,
'NOSCRIPT': NoScriptError,
@@ -92,7 +95,11 @@ class BaseParser(object):
error_code = response.split(' ')[0]
if error_code in self.EXCEPTION_CLASSES:
response = response[len(error_code) + 1:]
- return self.EXCEPTION_CLASSES[error_code](response)
+ exception_class = self.EXCEPTION_CLASSES[error_code]
+ if isinstance(exception_class, dict):
+ return exception_class.get(response, exception_class['default'])(response)
+ else:
+ return exception_class(response)
return ResponseError(response)