new and modify exceptions: devel
authorSandro Knauß <knauss@netzguerilla.net>
Tue, 14 Feb 2012 21:30:17 +0100
branchdevel
changeset 165 dd07766f4fee
parent 164 b634a8fed51f
child 166 6d6890f7e3f8
new and modify exceptions: ConfigExceptions OfferException
iro/error.py
--- a/iro/error.py	Tue Feb 14 21:27:51 2012 +0100
+++ b/iro/error.py	Tue Feb 14 21:30:17 2012 +0100
@@ -53,15 +53,36 @@
         ValidateException.__init__(self, 702, field, msg)
 
 class OfferException(Exception):
-    pass
+    def __init__(self, name):
+        self.name = name
 
 class NoRoute(OfferException):
-    pass
-class NoRouteForTask(Exception):
-    pass
+    def __str__(self):
+        return "Not a valid route: %s"%self.name
 
 class NoProvider(OfferException):
-    pass
+    def __str__(self):
+        return "Not a valid provider: %s"%self.name
+
+class NoTyp(OfferException):
+    def __str__(self):
+        return "Not a valid Typ: %s"%self.name
 
 class RejectRecipient(Exception):
     pass
+
+class ConfigException(Exception):
+    def __init__(self,section, name):
+        self.section = section
+        self.name = name
+
+class UnknownOption(ConfigException):
+    def __str__(self):
+        return "Unknown option '%s' in section '%s'."%(self.name, self.section)
+
+class NeededOption(ConfigException):
+    def __str__(self):
+        return "Option '%s' in section '%s' is missing."%(self.name, self.section)
+
+class NoRouteForTask(Exception):
+    pass