[GMG-Devel] [PATCH 03/83] Refactor exceptions raised by the search plugin

Alon Levy alon at pobox.com
Tue Feb 25 14:57:46 EST 2014


From: Praveen Kumar <praveen97uma at gmail.com>

---
 mediagoblin/plugins/search/exceptions.py | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/mediagoblin/plugins/search/exceptions.py b/mediagoblin/plugins/search/exceptions.py
index 4cec51f..d12a5a5 100644
--- a/mediagoblin/plugins/search/exceptions.py
+++ b/mediagoblin/plugins/search/exceptions.py
@@ -8,16 +8,12 @@ class BaseSearchError(Exception):
     def __init__(self, msg=None):
         self.msg = msg
 
-    def __str__(self):
-        return repr(self.msg)
-
-
 class IndexDoesNotExistsError(BaseSearchError):
     """
     Raised when an index does not exist.
     """
 
-    def __init__(self, index_dir, index_name):
-        self.msg = ('Index with name %s does not exists in search', 
-                    'index directory %s'%(index_dir, index_name))
-
+    def __init__(self, msg='', index_dir='', index_name=''):
+        super(IndexDoesNotExistsError, self).__init__(msg)
+        message = 'Index with name %(name)s does not exists in search index %(dir)s'
+        self.msg = message.format({'name': index_name, 'dir': index_dir})
-- 
1.8.5.3



More information about the devel mailing list