[mousetrap/gnome3-wip: 94/240] Simplified exceptions



commit ee0d8db139653c16b84703fb2beefc22af575fe9
Author: Kevin Brown <kbrown rediker com>
Date:   Fri Jun 13 19:34:17 2014 -0400

    Simplified exceptions
    
    As of Python 2.6 (PEP 352), exceptions now support passing in string
    messages as the first (and only) parameter.  These messages will be
    displayed when the exception is converted to a string, so all of the
    custom code we were using is no longer needed.
    
    http://stackoverflow.com/a/6029838/359284
    http://legacy.python.org/dev/peps/pep-0352/

 bin/mt-setup            |    2 +-
 src/mousetrap/vision.py |   12 ++----------
 2 files changed, 3 insertions(+), 11 deletions(-)
---
diff --git a/bin/mt-setup b/bin/mt-setup
index e90b2f4..0f06c4d 100644
--- a/bin/mt-setup
+++ b/bin/mt-setup
@@ -4,6 +4,6 @@ echo "Adding bin/ to PATH"
 source mt-add-bin-to-path
 echo "Adding src/ to PYTHONPATH"
 source mt-add-src-to-pythonpath
-echo "Defineing MOUSETRAP_HOME"
+echo "Defining MOUSETRAP_HOME"
 source mt-define-mousetrap-home
 cd - &> /dev/null
diff --git a/src/mousetrap/vision.py b/src/mousetrap/vision.py
index 7b97e64..dd90196 100644
--- a/src/mousetrap/vision.py
+++ b/src/mousetrap/vision.py
@@ -80,11 +80,7 @@ class HaarLoader(object):
 
 
 class HaarNameError(Exception):
-    def __init__(self, message):
-        super(HaarNameError, self).__init__()
-        self.message = message
-    def __str__(self):
-        return repr(self.message)
+    pass
 
 
 class FeatureDetector(object):
@@ -147,8 +143,4 @@ class FeatureDetector(object):
 
 
 class FeatureNotFoundException(Exception):
-    def __init__(self, message):
-        super(FeatureNotFoundException, self).__init__()
-        self.message = message
-    def __str__(self):
-        return repr(self.message)
+    pass


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]