~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/trace.py

Show exception class in error messages

Show diffs side-by-side

added added

removed removed

Lines of Context:
165
165
    The exception string representation is used as the error
166
166
    summary, unless msg is given.
167
167
    """
168
 
    cmd_repr = ' '.join(repr(arg) for arg in sys.argv)
169
 
    cmd_info = '\n  command: %s\n  pwd: %s' \
170
 
        % (cmd_repr, os.getcwd())
 
168
    ei = sys.exc_info()
171
169
    if msg == None:
172
 
        ei = sys.exc_info()
173
170
        msg = str(ei[1])
174
171
    if msg and (msg[-1] == '\n'):
175
172
        msg = msg[:-1]
176
 
    ## msg = "(%s) %s" % (str(type(ei[1])), msg)
177
 
    _bzr_logger.exception(msg + cmd_info)
178
 
 
 
173
    msg += '\n  command: %s' % ' '.join(repr(arg) for arg in sys.argv)
 
174
    msg += '\n      pwd: %r' % os.getcwdu()
 
175
    msg += '\n    error: %s' % ei[0]        # exception type
 
176
    _bzr_logger.exception(msg)
179
177
 
180
178
 
181
179
def log_exception_quietly():