summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2014-03-22 14:06:28 +0100
committerJon Bergli Heier <snakebite@jvnv.net>2014-03-22 14:06:28 +0100
commit71e9281823cc905c8885cf8a998a669d55726acf (patch)
treef755945a681b1a7d015b8295b8b4093caea099d8 /modules
parent9a2671c0d4d434fe9e18234ddb9fd74e0f3fabf0 (diff)
tracking: Handle unknown types in track_status.
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