summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/tracking.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/tracking.py b/modules/tracking.py
index 90b3555..8083182 100644
--- a/modules/tracking.py
+++ b/modules/tracking.py
@@ -79,6 +79,7 @@ class Package(Base):
class PackageError(Exception): pass
class NoPackageFound(PackageError): pass
+class UnknownTypeError(PackageError): pass
class TrackingResult:
def __init__(self, code, date, desc, delivered = False, previous_code = None):
@@ -250,6 +251,9 @@ def code_split(code):
def get_tracking_module(arg):
type, code = code_split(arg)
+ if not type in tracking_modules:
+ raise UnknownTypeError('Unknown type "%s"' % type)
+
return tracking_modules[type]()
class Module:
@@ -627,3 +631,5 @@ if __name__ == '__main__':
print '\n'.join(track)
else:
print track
+
+# vim: noet ts=4