Codebase list ctdconverter / run/f7d2cba8-82f2-49fa-bf4c-62d19f612fe3/main common / exceptions.py
run/f7d2cba8-82f2-49fa-bf4c-62d19f612fe3/main

Tree @run/f7d2cba8-82f2-49fa-bf4c-62d19f612fe3/main (Download .tar.gz)

exceptions.py @run/f7d2cba8-82f2-49fa-bf4c-62d19f612fe3/mainraw · history · blame

#!/usr/bin/env python
# encoding: utf-8

"""
@author:     delagarza
"""

from CTDopts.CTDopts import ModelError


class CLIError(Exception):
    # Generic exception to raise and log different fatal errors.
    def __init__(self, msg):
        super(CLIError).__init__(type(self))
        self.msg = "E: %s" % msg

    def __str__(self):
        return self.msg

    def __unicode__(self):
        return self.msg


class InvalidModelException(ModelError):
    def __init__(self, message):
        super(InvalidModelException, self).__init__()
        self.message = message

    def __str__(self):
        return self.message

    def __repr__(self):
        return self.message


class ApplicationException(Exception):
    def __init__(self, msg):
        super(ApplicationException).__init__(type(self))
        self.msg = msg

    def __str__(self):
        return self.msg

    def __unicode__(self):
        return self.msg