diff options
author | th13f <fpm.th13f@gmail.com> | 2015-10-26 13:53:31 +0300 |
---|---|---|
committer | th13f <fpm.th13f@gmail.com> | 2015-10-26 13:53:31 +0300 |
commit | d8507a7903c19a73a8bbcc33ce75c4f691890c2b (patch) | |
tree | 81eb50b4ecb486e66a1e664b49f2a65fa7730e23 /redis/connection.py | |
parent | 93ee0b97faab8de46a77b8cf140f68912e921e0a (diff) | |
download | redis-py-d8507a7903c19a73a8bbcc33ce75c4f691890c2b.tar.gz |
parsing 'max number of clients reached' as ConnectionError
Diffstat (limited to 'redis/connection.py')
-rwxr-xr-x | redis/connection.py | 11 |
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) |