def __str__ (self):
exc_type, exc_obj, exc_tb = sys.exc_info()
if not exc_tb:
return self.msg
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
src_line = str(linecache.getline(fname, exc_tb.tb_lineno))
s = "\n******\n"
s += "Error at {0}:{1} - '{2}'\n\n".format(format_text(fname, 'bold'), format_text(exc_tb.tb_lineno, 'bold'), format_text(src_line.strip(), 'bold'))
s += "specific error:\n\n{0}\n".format(format_text(self.msg, 'bold'))
return s
评论列表
文章目录