error.py 892 Bytes
Newer Older
Alberto Gonzalez's avatar
Alberto Gonzalez committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30


class BaseError(Exception):
    """Base exception with a hint whether to list traceback information or not.

    Attributes:
        msg -- explanation of the error
        list_traceback -- hint to an application level exception handler whether to list traceback information or not.
    """

    def __init__(self, msg, list_traceback=True):
        self.msg = msg
        self.list_traceback = list_traceback

    def __str__(self):
        return self.msg


class InvalidInputParameterError(BaseError):
    """Exception raised for invalid input parameters."""

    def __init__(self, msg, list_traceback=False):
        BaseError.__init__(self, msg, list_traceback)


class InvalidCommandLineArgumentError(BaseError):
    """Exception raised for invalid command line arguments."""

    def __init__(self, msg, list_traceback=False):
        BaseError.__init__(self, msg, list_traceback)