From b20329cb18534d1d2fcc817467b017aa4556010e Mon Sep 17 00:00:00 2001 From: Yossi Gottlieb Date: Tue, 4 Jun 2013 21:31:10 +0300 Subject: Add BusyLoadingError exception to differentiate -LOADING errors from connect errors. --- redis/__init__.py | 2 ++ redis/connection.py | 3 ++- redis/exceptions.py | 4 ++++ 3 files changed, 8 insertions(+), 1 deletion(-) 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 -- cgit v1.2.1 From 96b4e3d9de929fb43877e0c148455c6216e70056 Mon Sep 17 00:00:00 2001 From: Yossi Gottlieb Date: Tue, 4 Jun 2013 22:37:06 +0300 Subject: BusyLoadingError should inherit ConnectionError. --- redis/exceptions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/redis/exceptions.py b/redis/exceptions.py index 1e47972..d67afa7 100644 --- a/redis/exceptions.py +++ b/redis/exceptions.py @@ -17,7 +17,7 @@ class ConnectionError(ServerError): pass -class BusyLoadingError(ServerError): +class BusyLoadingError(ConnectionError): pass -- cgit v1.2.1