def get_error_repr(exc_info):
exc_type, exc_obj, exc_tb = exc_info
Trace = traceback.extract_tb(exc_tb)
trace_string = ""
Indent = ""
Text = ""
for file_name, line_no, func_name, text in Trace:
path, module_name = os.path.split(file_name)
# only print exceptions from Coquery files:
if any([path.startswith(x) for x in get_source_paths()]):
trace_string += "{} {}, line {}: {}\n".format(
Indent, module_name, line_no, func_name.replace("<", "<"))
Indent += " "
file_location = "{}, line {}".format(file_name, line_no)
if text:
trace_string += "%s> %s\n" % (Indent[:-1], text)
return (exc_type, exc_obj, trace_string, file_location)
评论列表
文章目录