iro/error.py
author Sandro Knauß <knauss@netzguerilla.net>
Tue, 10 Jan 2012 06:10:57 +0100
branchdevel
changeset 98 a60d344e28b4
parent 92 f479738b4879
child 110 601fc908d9f1
permissions -rw-r--r--
moving old tests in other dir

# -*- 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