[mousetrap/gnome3-wip: 89/240] Add HaarNameError.
- From: Heidi Ellis <heidiellis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mousetrap/gnome3-wip: 89/240] Add HaarNameError.
- Date: Mon, 8 Sep 2014 15:20:02 +0000 (UTC)
commit a251ca4ea7c60ae812ce31262105478f22edadcc
Author: Stoney Jackson <dr stoney gmail com>
Date: Thu Jun 12 14:17:50 2014 -0400
Add HaarNameError.
src/mousetrap/vision.py | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/mousetrap/vision.py b/src/mousetrap/vision.py
index 8cb7cae..2a076fd 100644
--- a/src/mousetrap/vision.py
+++ b/src/mousetrap/vision.py
@@ -51,8 +51,7 @@ class HaarLoader(object):
@staticmethod
def from_name(name):
if not name in HaarLoader._haar_files:
- # TODO: Throw an exception
- pass
+ raise HaarNameError(name)
haar_file = HaarLoader._haar_files[name]
@@ -80,6 +79,13 @@ class HaarLoader(object):
return haar
+class HaarNameError(Exception):
+ def __init__(self, message):
+ self.message = message
+ def __str__(self):
+ return repr(self.message)
+
+
class FeatureDetector(object):
def __init__(self, name, scale_factor=1.1, min_neighbors=3):
'''
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]