Project

General

Profile

« Previous | Next » 

Revision 1938

exc.py: print_ex(): Added plain option to leave out traceback

View differences:

lib/exc.py
51 51
def str_(e):
52 52
    return ''.join(traceback.format_exception_only(type(e), e)).rstrip()
53 53

  
54
def print_ex(e, emph=True):
55
    msg = str_(e)+'\n'+get_e_tracebacks_str(e)
54
def print_ex(e, emph=True, plain=False):
55
    if plain: emph = False
56
    
57
    msg = str_(e)+'\n'
58
    if not plain: msg += get_e_tracebacks_str(e)
56 59
    if emph:
57 60
        first_line, nl, rest = msg.partition('\n')
58 61
        msg = term.error(first_line)+nl+rest

Also available in: Unified diff