f42b150cb280ee0593bb40fee28cb5e6b5a3da3b
4 def format_exception(exception
):
5 """Format an exception as diagnostics output.
7 exception is the tuple as expected from sys.exc_info.
9 exception_lines
= traceback
.format_exception(*exception
)
10 # The lines returned from format_exception do not strictly contain
11 # one line per element in the list (i.e. some elements have new
12 # line characters in the middle). Normalize that oddity.
13 lines
= ''.join(exception_lines
).splitlines(True)
14 return format_as_diagnostics(lines
)
17 def format_as_diagnostics(lines
):
18 """Format the lines as diagnostics output by prepending the diagnostic #.
20 This function makes no assumptions about the line endings.
22 return ''.join(['# ' + line
for line
in lines
])
This page took 0.030263 seconds and 3 git commands to generate.