diff options
author | Yossi Gottlieb <yossigo@gmail.com> | 2013-06-04 21:31:10 +0300 |
---|---|---|
committer | Yossi Gottlieb <yossigo@gmail.com> | 2013-06-04 21:35:04 +0300 |
commit | b20329cb18534d1d2fcc817467b017aa4556010e (patch) | |
tree | 022ba069442d11d8582a2145557ce4a0293ccfbd | |
parent | 7d8674f3edb326f29e4a1552ae674ea3ca6e7808 (diff) | |
download | redis-py-b20329cb18534d1d2fcc817467b017aa4556010e.tar.gz |
Add BusyLoadingError exception to differentiate -LOADING errors from connect errors.
-rw-r--r-- | redis/__init__.py | 2 | ||||
-rw-r--r-- | redis/connection.py | 3 | ||||
-rw-r--r-- | redis/exceptions.py | 4 |
3 files changed, 8 insertions, 1 deletions
diff --git a/redis/__init__.py b/redis/__init__.py index 949ea70..8590b1b 100644 --- a/redis/__init__.py +++ b/redis/__init__.py @@ -9,6 +9,7 @@ from redis.utils import from_url from redis.exceptions import ( AuthenticationError, ConnectionError, + BusyLoadingError, DataError, InvalidResponse, PubSubError, @@ -26,4 +27,5 @@ __all__ = [ 'Connection', 'UnixDomainSocketConnection', 'RedisError', 'ConnectionError', 'ResponseError', 'AuthenticationError', 'InvalidResponse', 'DataError', 'PubSubError', 'WatchError', 'from_url', + 'BusyLoadingError' ] diff --git a/redis/connection.py b/redis/connection.py index e138d4c..343c838 100644 --- a/redis/connection.py +++ b/redis/connection.py @@ -9,6 +9,7 @@ from redis._compat import (b, xrange, imap, byte_to_chr, unicode, bytes, long, from redis.exceptions import ( RedisError, ConnectionError, + BusyLoadingError, ResponseError, InvalidResponse, AuthenticationError, @@ -37,7 +38,7 @@ class PythonParser(object): EXCEPTION_CLASSES = { 'ERR': ResponseError, 'EXECABORT': ExecAbortError, - 'LOADING': ConnectionError, + 'LOADING': BusyLoadingError, 'NOSCRIPT': NoScriptError, } diff --git a/redis/exceptions.py b/redis/exceptions.py index af30cbf..1e47972 100644 --- a/redis/exceptions.py +++ b/redis/exceptions.py @@ -17,6 +17,10 @@ class ConnectionError(ServerError): pass +class BusyLoadingError(ServerError): + pass + + class InvalidResponse(ServerError): pass |