iro/error.py
branchdevel
changeset 92 f479738b4879
child 110 601fc908d9f1
equal deleted inserted replaced
91:191c2c1d6e53 92:f479738b4879
       
     1 # -*- coding: utf-8 -*-
       
     2 
       
     3 class InterfaceException(Exception):
       
     4     def __init__(self, code=999, msg="Unbekannter Fehler."):
       
     5         self.code=code
       
     6         self.msg=msg
       
     7 
       
     8     def dict(self):
       
     9         return {"code":self.code,
       
    10                 "msg":self.msg,
       
    11                 }
       
    12     def __str__(self):
       
    13         return "%i:%s"%(self.code,self.msg)
       
    14 
       
    15 class UserNotFound(InterfaceException):
       
    16     def __init__(self):
       
    17         InterfaceException.__init__(self, 901, "Der API-Key ist ungültig.")
       
    18 
       
    19 class ExternalException(InterfaceException):
       
    20     def __init__(self):
       
    21         InterfaceException.__init__(self, 950, "Fehler in externer API.")
       
    22 
       
    23 class ValidateException(Exception):
       
    24     pass