~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/trace.py

Update to bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
414
414
        return errors.EXIT_INTERNAL_ERROR
415
415
 
416
416
 
 
417
def print_exception(exc_info, err_file):
 
418
    exc_type, exc_object, exc_tb = exc_info
 
419
    err_file.write("bzr: ERROR: %s.%s: %s\n" % (
 
420
        exc_type.__module__, exc_type.__name__, exc_object))
 
421
    err_file.write('\n')
 
422
    traceback.print_exception(exc_type, exc_object, exc_tb, file=err_file)
 
423
 
 
424
 
417
425
# TODO: Should these be specially encoding the output?
418
426
def report_user_error(exc_info, err_file):
419
427
    """Report to err_file an error that's not an internal error.
421
429
    These don't get a traceback unless -Derror was given.
422
430
    """
423
431
    if 'error' in debug.debug_flags:
424
 
        report_bug(exc_info, err_file)
 
432
        print_exception(exc_info, err_file)
425
433
        return
426
434
    err_file.write("bzr: ERROR: %s\n" % (exc_info[1],))
427
435
 
428
436
 
429
437
def report_bug(exc_info, err_file):
430
438
    """Report an exception that probably indicates a bug in bzr"""
431
 
    exc_type, exc_object, exc_tb = exc_info
432
 
    err_file.write("bzr: ERROR: %s.%s: %s\n" % (
433
 
        exc_type.__module__, exc_type.__name__, exc_object))
434
 
    err_file.write('\n')
435
 
    traceback.print_exception(exc_type, exc_object, exc_tb, file=err_file)
 
439
    print_exception(exc_info, err_file)
436
440
    err_file.write('\n')
437
441
    err_file.write('bzr %s on python %s (%s)\n' % \
438
442
                       (bzrlib.__version__,