Revision 3605
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/exc.py | ||
---|---|---|
62 | 62 |
def str_(e, first_line_only=False): |
63 | 63 |
if isinstance(e, SyntaxError): |
64 | 64 |
# format_exception_only() provides special formatting for SyntaxErrors. |
65 |
msg = u''.join(traceback.format_exception_only(type(e), e))
|
|
65 |
msg = (u''.join(traceback.format_exception_only(type(e), e))).rstrip()
|
|
66 | 66 |
else: |
67 | 67 |
# Avoid traceback exception-formatting functions because they escape |
68 | 68 |
# non-ASCII characters with \x, causing exception parsers to read an |
69 | 69 |
# incorrect, escaped value. |
70 |
msg = util.class_name(e)+': '+strings.ustr(e.args[0])
|
|
70 |
msg = e_str(e)
|
|
71 | 71 |
|
72 | 72 |
if first_line_only: msg = msg.partition('\n')[0] |
73 |
return msg.rstrip()
|
|
73 |
return msg |
|
74 | 74 |
|
75 | 75 |
def print_ex(e, emph=True, detail=True, plain=False): |
76 | 76 |
if plain: |
Also available in: Unified diff
exc.py: Use new e_str() where its definition was used