~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/trace.py

Handle errors logging errors

Show diffs side-by-side

added added

removed removed

Lines of Context:
166
166
    summary, unless msg is given.
167
167
    """
168
168
    ei = sys.exc_info()
169
 
    if msg == None:
170
 
        msg = str(ei[1])
 
169
    try:
 
170
        if msg == None:
 
171
            msg = str(ei[1])
 
172
    except Exception, e:
 
173
        msg = "Error logging exception of type %s\n" % ei[1].__class__.__name__
 
174
        try:
 
175
            msg += str(e)
 
176
        except:
 
177
            pass
171
178
    if msg and (msg[-1] == '\n'):
172
179
        msg = msg[:-1]
173
180
    msg += '\n  command: %s' % ' '.join(repr(arg) for arg in sys.argv)