如何从python中的异常消息中删除类名

时间:2018-06-29 11:52:10

标签: python exception-handling

这是我的python代码中的异常消息:

Common.AnimalClass.NestedClass: Id is not found    

我想排除类名,只想打印如下消息:

Id is not found

我是python的新手, 如何在python3中实现这一目标?

    if not (is_id_present):
        self.log_step_status("FAIL", step_name)
        log_message = 'id is not found'
        raise TestCaseFailureError(log_message)

class TestCaseFailureError(Exception, vlogger):
"""Base Error class for tests"""

def __init__(self, *args, **kwargs):
    self.vlog('Message: {0}', args[0])
    Exception.__init__(self, *args, **kwargs)

0 个答案:

没有答案