Project

General

Profile

« Previous | Next » 

Revision 1636

exc.py: str_(): Strip trailing whitespace. print_ex(): Since str_() now strips trailing whitespace, strings.ensure_newl() is no longer necessary.

View differences:

lib/exc.py
48 48
        if cause != None: msg += ': '+str_(cause)
49 49
        Exception.__init__(self, msg)
50 50

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

  
53 54
def print_ex(e, emph=True):
54
    msg = strings.ensure_newl(str_(e))+get_e_tracebacks_str(e)
55
    msg = str_(e)+'\n'+get_e_tracebacks_str(e)
55 56
    if emph:
56 57
        first_line, nl, rest = msg.partition('\n')
57 58
        msg = term.error(first_line)+nl+rest

Also available in: Unified diff