iro/error.py
branchdevel
changeset 92 f479738b4879
child 110 601fc908d9f1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/iro/error.py	Thu Dec 22 03:13:34 2011 +0100
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+
+class InterfaceException(Exception):
+    def __init__(self, code=999, msg="Unbekannter Fehler."):
+        self.code=code
+        self.msg=msg
+
+    def dict(self):
+        return {"code":self.code,
+                "msg":self.msg,
+                }
+    def __str__(self):
+        return "%i:%s"%(self.code,self.msg)
+
+class UserNotFound(InterfaceException):
+    def __init__(self):
+        InterfaceException.__init__(self, 901, "Der API-Key ist ungültig.")
+
+class ExternalException(InterfaceException):
+    def __init__(self):
+        InterfaceException.__init__(self, 950, "Fehler in externer API.")
+
+class ValidateException(Exception):
+    pass