DartQCException.py 文件源码

python
阅读 33 收藏 0 点赞 0 评论 0

项目:dartqc 作者: esteinig 项目源码 文件源码
def __init__(self, *msg):
        message = ""
        for arg in msg:
            message += str(arg)

        try:
            ln = sys.exc_info()[-1].tb_lineno
            file = traceback.extract_tb(sys.exc_info()[-1])
            if isinstance(file, list):
                file = file[0].filename
        except AttributeError:
            ln = inspect.currentframe().f_back.f_lineno
            file = inspect.getframeinfo(inspect.currentframe().f_back).filename

        if file is not None:
            file = re.compile("[\\\/]+").split(file)
            file = file[-1]

        self.args = "Error ({3}:{1}): {2}".format(type(self), ln, message, file),
        sys.exit(self)

    # def __init__(self, *args, **kwargs):
    #     RuntimeError.__init__(self, args, kwargs)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号