Project

General

Profile

« Previous | Next » 

Revision 2246

exc.py: Support exception messages containing non-ASCII characters

View differences:

lib/exc.py
36 36
    except AttributeError: return ''
37 37
    return ''.join(get_traceback_str(t) for t in tracebacks)
38 38

  
39
def add_msg(e, msg): e.args = (strings.ensure_newl(str(e))+msg,)
39
def add_msg(e, msg): e.args = (strings.ensure_newl(strings.ustr(e))+msg,)
40 40

  
41
def repl_msg(e, **repls): e.args = (str(e) % repls,)
41
def repl_msg(e, **repls): e.args = (strings.ustr(e) % repls,)
42 42

  
43 43
def e_ct_exit_status(e_ct): return min(e_ct, 255)
44 44

  
......
51 51
        Exception.__init__(self, msg)
52 52

  
53 53
def str_(e):
54
    return ''.join(traceback.format_exception_only(type(e), e)).rstrip()
54
    return u''.join(traceback.format_exception_only(type(e), e)).rstrip()
55 55

  
56 56
def print_ex(e, emph=True, detail=True, plain=False):
57 57
    if plain:

Also available in: Unified diff